Commit Graph
72 Commits
Author SHA1 Message Date
qndel 731ad1ada5 use std::rotate (#6019) 2023-04-22 13:53:03 +02:00
staphen bfc54c9bd3 Add arena potions to the virtual gamepad renderer 2023-04-14 10:26:46 +02:00
qndel ce2ce86070 inspect players command 2023-04-14 02:40:17 +02:00
obligaron 2296bf5625 Use StashStruct::EmptyCell instead for empty stash item check 2023-03-21 14:15:00 -04:00
KPhoenix a1fbf5253f enum talk_id -> enum class TalkID 2023-02-09 13:04:01 +01:00
KPhoenix d813f13700 enum spell_id -> enum class SpellID 2023-02-05 10:24:58 +00: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 57e267e990 button.png: Arrange sprites horizontally
87x2262 -> 1131x174

This makes the file smaller and also makes the texture fit
on devices with 2048x2048 max texture size (Fixes #5403).

`button.png` updated with:

    convert -crop 87x174 button.png +append out.png
    optipng -o9 out.png
    mv out.png button.png
2022-10-15 14:20:05 +01:00
Gleb Mazovetskiy 4cf0053ece Set underlying type for all the enums
Reduces rg99 binary size by 3 KiB.
2022-08-11 01:43:54 +02:00
Gleb Mazovetskiy 580d3cb6ee touch/renderers: Migrate away from Art 2022-08-08 14:29:45 +01: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
ephphatha 9e76cd4ab7 Use object pointer for pcursobj 2022-07-19 13:20:24 +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
Anders Jenbo a7be622aa3 Clean up naming of event handler 2022-07-10 21:13:39 +02:00
Mikołaj Piróg 15989609a8 Members' name changes and comments in Monster struct (#4861) 2022-07-06 10:21:22 +02:00
Anders Jenbo 99181fd709 Move more files to the engine folder 2022-06-24 11:08:15 +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
Gleb Mazovetskiy 8e9c9e0238 Reduced the size of OwnedCelSprite* by 8 bytes
`OwnedCelSpriteWithFrameHeight`: 40 -> 32
2022-06-20 01:11:22 +02:00
Gleb Mazovetskiy 2386fd12a9 Fix a few warnings 2022-06-15 13:01:20 +02:00
staphen b349e29058 Correctly indicate when scroll can be used on virtual gamepad 2022-06-07 01:35:20 +02:00
qndel 354e329644 Players[MyPlayerId] -> MyPlayer 2022-05-31 05:35:52 +02:00
staphen 0c4940fc00 Skip touch interactions with stash when stash is not open 2022-05-22 02:39:10 +02:00
staphen 0b41ce271f Skip touch interactions with main panel when not in a game session 2022-05-22 02:39:10 +02:00
ephphatha 7f15aa730d Move definition of ghMainWnd to utils/display.cpp
This variable is controlled/set by the code in that file, this also lets other files have more specific/relevant includes instead of the monolith that is diablo.h
2022-05-08 12:09:12 +02:00
staphen ef9ae41f6a Fix item graphics on potion buttons for virtual gamepad 2022-04-24 19:22:59 +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
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
Anders Jenbo c68af7a5bf [touch] Allow interacting with the spell book
Fixes #4393
2022-04-11 06:31:20 +02:00
Anders Jenbo 3b86c7fac4 [touch] Spend stat points when clicking the buttons
Fixes #4387
2022-04-11 02:26:48 +02:00
staphen 6250067283 Touchscreen navigation for stash 2022-04-03 02:18:44 +02:00
staphen 6a30cd3950 Add gamepad support for stash 2022-03-30 23:12:09 +02:00
Anders Jenbo 9226f1435c Clean up PotionButtonRenderer 2022-03-30 22:46:10 +02:00
Anders Jenbo a48f89007d Implement stash 2022-03-18 06:01:53 +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
obligaron 234a053863 Change Missiles Array to std::list 2022-01-20 23:12:48 +01:00
Anders Jenbo 2e0a73e967 Disable stand button when in town
Fixes #3290
2022-01-03 23:26:33 +01:00
staphen d193b90101 Don't deactivate gamepad when graphics settings change 2022-01-02 11:37:38 +01:00
Anders Jenbo 576d946581 Allow use of touch to select world objects 2022-01-02 11:37:38 +01:00
Anders Jenbo 6b2481a76c Touch support on all SDL2 platforms 2022-01-02 11:37:38 +01:00
Anders Jenbo d3a7c36d1d Correct DPI on devices that apply extra scaling 2021-12-05 17:32:41 +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 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
obligaron 677303cba9 Reduce use of view globals in game menu 2021-11-20 21:57:32 +01:00
staphen 08e4e8c254 Implement virtual gamepad activation/deactivation 2021-11-15 00:55:32 +01:00
staphen 40cc894630 Force VIRTUAL_GAMEPAD=OFF when USE_SDL1=ON 2021-11-15 00:55:32 +01:00
Gleb Mazovetskiy 3d308983a8 Migrate to libmpq
libmpq is a much simpler alternative to StormLib for reading MPQ archives.

We use our own fork of libmpq: https://github.com/diasurgical/libmpq

Impact:

* DevilutionX is now a lot more portable. Unlike StormLib, libmpq only
  needs platform-specific code for Windows.
* Locks around file access **removed** (instead we duplicate the file descriptor for streamed audio only).
* RAM usage is **300 KiB** lower than StormLib.
* Stripped release linux_x86_64 binary is **32 KiB** smaller.
* Amiga build now hangs instead of crashing.
2021-11-06 23:51:42 +00:00
staphen e2408bc6bc [Virtual Gamepad] Set primary action button graphic to apply in char panel when applying stat points for level up 2021-10-28 08:36:19 +02:00
staphen 85f0e7b8c3 Add button for standing still to attack 2021-10-26 07:54:51 +02:00
Anders Jenbo 609414fd69 [touch] Indicate level up in a touch friendly way 2021-10-26 07:52:06 +02:00