259 Commits
Author SHA1 Message Date
ephphatha 3b458376bb Use a pointer to a player instance instead of network id for cursor hovering 2023-11-09 17:40:50 +01:00
qndel be1d87fd29 fix selecting monsters outside of vision range 2023-08-27 18:20:07 +02:00
Gleb Mazovetskiy 8ebe2e0290 Fix -Wsign-compare warnings 2023-08-14 01:54:29 +01:00
Gleb Mazovetskiy c19bfe87fa Remove utils/stdcompat/algorithm.hpp 2023-08-14 01:54:29 +01:00
Gleb Mazovetskiy 62d067b653 Remove utils/stdcompat/abs.hpp 2023-08-14 01:54:29 +01:00
obligaron 97f9045c83 Introduce TrySelectPixelBased 2023-08-12 17:47:31 +02:00
obligaron e8838a73d5 Refactor CheckCursMove() 2023-08-12 17:47:31 +02:00
Gleb Mazovetskiy 5bf0b8bc96 Add more missing <cstdint> includes
https://github.com/diasurgical/devilutionX/pull/6095 only added includes
for `uint32_t`, this PR also adds the includes for the remaining
integral types.
2023-05-10 16:29:27 +01: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
Gleb Mazovetskiy 5d35b289bb Skip creating half-size sprites for 1x1 items
We never use these anyway
2023-01-24 04:41:34 +00:00
Gleb Mazovetskiy 37f4d0cb97 CreateHalfSizeItemSprites: Reuse surfaces
Rather than allocating surfaces on every loop iteration, reuse the same
2 surfaces.
2023-01-24 04:41:34 +00:00
Gleb Mazovetskiy f9f61fcb0c Do not try to create Hellfire sprites in Diablo
Fixes #5709
2023-01-23 10:02:45 +00:00
Gleb Mazovetskiy 67bb0e10fd Store items: Draw unusable items in red
We generate separate downscaled sprites for the red versions
because simply applying TRN after downscaling leads to some
non-red pixels (because of blending during downscaling).
2023-01-23 01:53:14 +00:00
Gleb Mazovetskiy c5369f4b2b Store graphics: Scale sprites only once
Prepare downscaled sprites once instead of doing it on every frame.

Note that we do this lazily in `StartStore` rather than
`SetupTownStores` because we need the palette blending table to be
available when downscaling.
2023-01-22 14:56:25 +00:00
KPhoenix 8db521727d enum missile_id -> enum class MissileID
Changes `enum missile_id` to `enum class MissileID`
2023-01-18 17:17:25 +00:00
Anders Jenbo a29fc3a074 Correct casing for Player::isWalking() 2023-01-12 09:42:49 +01:00
Gleb Mazovetskiy 680ab5ec40 Overhaul backbuffer state handling
When rendering directly to the output buffer, we need to maintain the
state of what has been drawn and what needs redrawing per-buffer.

We previously tried to do it implicitly by checking `SDL_DOUBLEBUF` and
other flags. The previous implementation was broken in several
ways, resulting in rendering issues on devices that support 8-bit output
directly.

Changes this mechanism to explicitly maintain buffer state per output
buffer. The new mechanism doesn't require knowledge of the number of
buffers, and thus also works correctly with triple-buffering.

Fixes #5447
2022-11-01 02:43:24 +00:00
staphen e67e4934cc Add padmapper for gamepad customization 2022-10-17 01:01:21 +02:00
Gleb Mazovetskiy 41f43ea3f5 Support unpacked MPQs from devilutionx-mpq-tools
https://github.com/diasurgical/devilutionx-mpq-tools produces an unpacked MPQ
with all the graphics converted to CLX and the unused files removed.
This is primarily useful on RAM-constrained platforms, such as PS2,
because it eliminates the MPQ overhead.

Adds a build option to load from such unpacked directories instead of the MPQ.

These directories are searched for in the same locations
where the MPQs would be searched for otherwise.

Example directory layout:

* /usr/local/share/diasurgical/devilutionx/diabdat/ -- unpacked and converted diabdat.mpq
* /usr/local/share/diasurgical/devilutionx/hellfire/ -- unpacked and converted hellfire MPQs (all of them merged into 1 directory)
* /usr/local/share/diasurgical/devilutionx/fonts/ -- unpacked fonts.mpq
* /usr/local/share/diasurgical/devilutionx/pl/ -- unpacked pl.mpq

These directory structure is produced by calling `unpack_and_minify_mpq`
2022-10-11 18:00:57 +01:00
staphen 8b6db3a678 Get rid of panelstr, pnumlines, and ClearPanel() 2022-10-02 08:51:24 +02:00
Gleb Mazovetskiy 188dc79f6e Make Players a vector 2022-08-26 13:22:04 +09:00
Cyril SIX 17bf252608 Turn off monster highlighting with Heal Other and Resurrect cursors 2022-08-22 00:13:24 +02:00
Gleb Mazovetskiy 6327e713e0 Lowercase all file paths
We want to be able to use unpacked MPQs on low-end platforms
(PS2/rg99/etc).

This is tricky on case-sensitive filesystems. Avoids case issues by
lowercasing all paths in the code (then we'll just need lowercased
listfiles).
2022-08-20 23:49:23 +01:00
qndel 4d571e0f77 fix cursor item being overwritten 2022-08-16 18:23:29 +02:00
obligaron 04287fc4d2 Cursor: Always use result of CalcTileOffset (#5221) 2022-08-08 21:12:07 +02:00
Gleb Mazovetskiy 9b65eca49b Remove Art and related functions 2022-08-08 14:29:45 +01:00
Gleb Mazovetskiy f3e37781d9 ArtCursor: Art -> CLX 2022-08-08 14:29:45 +01:00
obligaron 2493f06116 ActorPosition: Remove offset, offset2 and velocity 2022-08-03 21:25:21 +02:00
obligaron a410e989bf Remove ScrollInfo 2022-08-03 21:25:21 +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
ephphatha 0ce76a3f13 Add Object lookup method to mimic map::at() 2022-07-28 12:47:13 +02:00
ephphatha 2b442a73c2 Fix highlighting towners 1-4 after visiting the dungeon 2022-07-26 01:40:20 +02:00
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
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
Mikołaj Piróg 262fa9ac2d Rename MonsterData members (#5000) 2022-07-15 16:20:13 +02:00
Trihedraf 5ee6e5dd3a Make zoom a setting in the menu (#4931) 2022-07-10 19:59:32 +02:00
Anders Jenbo 6a8fd04067 Use player by references (#4938) 2022-07-10 11:40:04 +02:00
Mikołaj Piróg 15989609a8 Members' name changes and comments in Monster struct (#4861) 2022-07-06 10:21:22 +02:00
Gleb Mazovetskiy 6949a6f418 Monster: Remove MType/MData pointers
These pointers are redundant, replaces them with methods.
2022-07-03 13:21:11 +01:00
Gleb Mazovetskiy d152d2c0fb Add OptionalOwnedCelSprite 2022-07-03 12:26:39 +01: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 1fc8ecb6f6 Add fmt::runtime annotations for C++20 support
`fmt` requires non-contexpr format string arguments to be wrapped in
`fmt::runtime` in C++20.
2022-06-14 12:46:36 +01:00
qndel 354e329644 Players[MyPlayerId] -> MyPlayer 2022-05-31 05:35:52 +02:00
obligaron bc15bdf3a9 Remove PANEL_ defines and replace them with GetMainPanel() 2022-05-29 20:20:44 +02:00
obligaron 70c5cf6cad Fix item label text with open stash (#4595)
* Item labels: check if stash is open in IsMouseOverGameArea

* Add IsLeft/RightPanelOpen
2022-05-20 09:12:54 +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