293 Commits

Author SHA1 Message Date
Anders Jenbo 005e7dcc23 chore: clang-tidy cleanup part 1 2026-04-03 22:57:48 +02:00
obligaron ee42d2ab66 Add missiles to tile data debug command 2025-02-03 08:10:14 +01:00
obligaron 4f9e063197 Change GetDebugGridText text from char to string 2025-02-03 08:10:14 +01:00
Eric Robinson f1d48d7124 Debug: Insivible (#7543) 2024-11-16 18:26:59 +01:00
Gleb Mazovetskiy 8c39edfe7e Add dev.display.tileData('microTiles') 2024-09-27 17:38:18 +02:00
Gleb Mazovetskiy e9c29fa806 Switch to ankerl::unordered_dense 2024-08-05 01:17:13 +01:00
staphen ce60a17fd5 Fix OOB when debugging megatile data near the edge of the dungeon 2024-04-30 14:20:48 -04:00
Eric Robinson 0ac30d101d Refactor TileHasAny() (#7085) 2024-04-19 08:04:26 +02:00
Gleb Mazovetskiy a2b94cc03c Lua: Migrate and organize the rest of debug cmds
Fully migrates debug commands to Lua and organizes them into logical
groups.

The CLI `+` syntax now runs Lua, e.g.:

```bash
build/devilutionx '+dev.player.trn.plr("infra")'
```

Chat hotkeys run Lua code if they start with `/lua`, e.g.:

```ini
[NetMsg]
QuickMessage1=/lua message(dev.player.info())
```
2023-11-07 22:27:48 +00:00
Gleb Mazovetskiy 8bffbedcb4 Migrate some debug.cpp commands to Lua
Introduces a new `devilutionx.dev` Lua module, automatically loaded in
the console prelude.

Arguments and basic help are shown in autocompletion.
2023-11-04 20:28:27 +00:00
Gleb Mazovetskiy 3ea4996367 Add a basic Quake-style console
Enabled only in Debug mode.

Runs Lua similar to the `lua` CLI.
Supports multiline input with Shift+Enter.

Missing features:
1. Scrollback.
2. Input history on up/down.

Open with backtick, close with Esc.
2023-10-31 23:19:56 +00:00
Gleb Mazovetskiy de6eac137b Split up lua bindings a bit
```lua
local render = devilutionx.render

local function drawGreet ()
  render.string("Hello from " .. _VERSION, 10, 40)
end
Events.OnGameDrawComplete.Add(drawGreet)
```
2023-10-26 03:48:56 +01:00
tetektoza e81407071f Debug: Add possibility to specify amount of gold in TakeGold cmd
Currently in GiveGold and TakeGold commands in debug.cpp we only have
a possibility to flood our inventory with gold, this patch adds a
possibility to either specify amount of gold to be added or just
write "max" which will preserve native functionality of those commands,
by clearing all gold or giving max gold possible (depending on the
amount of free slots in inventory).
2023-10-20 18:50:47 +02:00
tetektoza b5c3d4f1c6 Debug: Add possibility to specify amount of gold in GiveGold cmd
Currently in GiveGold and TakeGold commands in debug.cpp we only have a
possibility to flood our inventory with gold, this patch adds a
possibility to either specify amount of gold to be added or just write
"max" which will preserve native functionality of those commands, by
clearing all gold or giving max gold possible (depending on the amount
of free slots in inventory).
2023-10-20 18:50:47 +02:00
Gleb Mazovetskiy 493aaf554e Add a lua debug command
Ideally we should have a better UI for this in the future.
2023-10-16 09:21:02 +01:00
Gleb Mazovetskiy 88bbf4f913 Improve DiabloMsg handling
1. Simplified implementation.
2. Now adjusts the box size to fit the content (e.g. when wrapping
   failed or when there are too many lines).
2023-10-14 09:45:24 +01:00
Gleb Mazovetskiy d1d27c8368 Rename error -> diablo_msg 2023-10-14 09:45:24 +01:00
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 Mazovetskiy 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 <ephphatha@thelettereph.com>
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