Commit Graph
276 Commits
Author SHA1 Message Date
tetektoza 41c5175444 Clip parsed level from debug console to 50
Currently, in givelvl command user can type lvl above 50, which is a
level cap. This patch clips it to 50, so we can prevent an accidential
freeze of the game caused by NetSendCmd loop if user types a really big
number.
2023-10-11 18:47:05 -04:00
staphen 7855dae582 Indicate network validation success or failure in iteminfo 2023-09-19 05:11:51 +02:00
Eric Robinson bc3a421622 Debug: Revise Text (#6625) 2023-09-19 00:43:30 +00:00
Eric Robinson 058a0d132d Debug: Improved iteminfo command (#6623) 2023-09-18 12:49:47 +02:00
KPhoenix 6dd8ce26a0 Debug: Convert DiabloMsg to EventPlrMsg 2023-09-18 12:26:22 +02:00
DakkJaniels 3d3cc31ebb add missing continue 2023-09-11 12:35:29 -04:00
DakkJaniels aba9d79a1a Fix spawn and spawnu (#6594) 2023-09-11 18:02:15 +02:00
Gleb Mazovetskiy 62e9aa0448 MissilePosition: Use WorldTilePosition
Reduces struct size and makes the types of coordinates more obvious.
2023-08-29 20:00:54 +01:00
Gleb Mazovetskiy 5355146d51 Use structured bindings 2023-08-29 12:56:49 +01:00
Gleb Mazovetskiy ebe8c6e576 Add tl::expected and use it in ParseInt
`std::expected` has been standardized for C++23.
2023-08-19 17:13:54 +09:00
Gleb Mazovetskiy 8c1a847f41 Remove utils/stdcompat/string_view.hpp 2023-08-14 09:59:14 +01:00
Gleb Mazovetskiy e9b5ec77f9 Remove AppendStrView 2023-08-14 01:54:29 +01:00
Gleb Mazovetskiy 62d067b653 Remove utils/stdcompat/abs.hpp 2023-08-14 01:54:29 +01:00
Gleb MazovetskiyandAndrew James 53db86ee9a Use std::from_chars instead of std::stoi
Adds a `ParseInt` function which uses `std::from_chars`.

From `std::from_chars` documentation:
> Unlike other parsing functions in C++ and C libraries,
> std::from_chars is locale-independent, non-allocating, and non-throwing.

Co-authored-by: Andrew James <[email protected]>
2023-08-13 21:43:53 +02:00
Gleb Mazovetskiy 8101e2c0ba Add c_any_of and friends
Adds handy helpers for performing algorithms on the entire container.
They're prefixed with `c_` for container.

This naming convention is identical to some popular C++ libraries, such
as Abseil.
2023-08-12 16:24:01 +01:00
Gleb Mazovetskiy 1167b92692 Remove uses of std::tolower
`std::tolower` relies on the C locale, which we try to avoid.
2023-06-18 04:55:47 +01:00
staphen 1cb367ab91 Move seedinfo to text commands 2023-06-04 02:36:52 +02:00
staphen 48caf5004f [Debug] Add more data to seedinfo 2023-06-03 12:02:08 +02:00
qndel c362808165 debug path command (#6101) 2023-05-13 10:20:15 +01:00
Gleb Mazovetskiy 4fa3732526 Add missing <cstdint> includes
Done with the following script:

```ruby
Dir["Source/**/*.{h,c,cc,cpp,hpp}"].each do |path|
  v = File.read(path)
  next if !v.include?("uint32_t") || v.include?("cstdint")

  lines = v.lines
  line_num = if lines[2].start_with?(" *")
    lines.index { |l| l.start_with?(" */") } + 3
  else
    3
  end

  lines.insert(line_num, "#include <cstdint>\n")

  File.write(path, lines.join(""))
end
```

then fixed-up manually
2023-05-10 13:50:12 +01:00
obligaron bf86114ec3 Sync learned/changed spells 2023-04-24 18:19:27 +02:00
obligaron 7985a9211d Change Player::_pSplLvl to uint8_t 2023-04-24 18:19:27 +02:00
Anders Jenbo 3af438db93 Debug: Improve rendering of light gird
LightsMax is the darkest value, and the most common so lets not have that rendered all over the screen.
2023-04-19 01:13:49 +02:00
Anders Jenbo 6c893e4977 Remove unused code 2023-04-18 21:21:53 +02:00
obligaron 40bb3aeb45 Replace earflag with DeathReason 2023-04-14 23:34:54 +02:00
obligaron 590c990c80 Introduce Item::getName 2023-04-13 00:07:00 +02:00
obligaron 4cdd7ff2d9 Replace ReturnLevel/LevelTyp/LvlPosition 2023-03-12 19:30:57 +01:00
obligaron 0d2e43daa8 Add search monster/item/object debug commands 2023-02-26 04:40:31 +01:00
Gleb Mazovetskiy 1a1a282d9a Use C FILE instead of C++ streams throughout
Reduces binary size by ~2 KiB and may improve compatibility with oddball
systems (e.g. PS2).
2023-02-15 18:15:07 +00:00
KPhoenix 5794aefded Refactor debug commands 2023-02-06 01:58:49 +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
obligaron 0c3b434d76 Make debug command restart compatible with multiplayer 2022-12-17 19:37:52 +01:00
KPhoenix c16b4932b1 Debug: Add maxstats and minstats command (#5539)
* Debug: Add maxstats command

Maxes all player stats

* clang

* Remove network command

* Add minstats command

* Improve functions
2022-11-27 10:26:54 -05: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
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
Gleb Mazovetskiy 188dc79f6e Make Players a vector 2022-08-26 13:22:04 +09: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 5dc95550ce Add TRN debug command and support for optional class TRNs 2022-08-11 01:02:36 +02:00
qndel aa2b9dab74 fix debug questmap command (#5206) 2022-08-07 02:36:09 +02:00
Gleb Mazovetskiy ba34bafb3f Use SDL events directly
Removes redundant miniwin events and queue, using SDL events directly instead.

Demo migrated using this script: https://gist.github.com/glebm/8a73b04f695de96f344cc2e35151e03e
2022-08-03 03:50:19 +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 35bf79b007 Use Monster& in PrintDebugMonster 2022-07-25 14:43:50 +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 4c1dbaba72 Demo mode: Handle endianness 2022-07-18 10:35:27 +01:00
Anders Jenbo d1189388f5 Use user by reference 2022-07-17 18:41:05 +02:00
Gleb Mazovetskiy 3d4f0b48b8 Remove TranslateMessage
It has become entirely redundant.
2022-07-17 11:44:52 +02:00
Anders Jenbo 16b65120ea Clean up LevelMonsterTypes related code 2022-07-15 19:36:47 +02:00
Mikołaj Piróg 262fa9ac2d Rename MonsterData members (#5000) 2022-07-15 16:20:13 +02:00