811 Commits
Author SHA1 Message Date
obligaron 8cb167ac98 Implement quick spell cycling 2023-12-14 22:17:57 +01:00
obligaron 426dd4c4af Add scroll wheel support to keymapper 2023-12-14 22:17:57 +01:00
obligaron 244d3d2f3a Remove scroll wheel hack 2023-12-14 22:17:57 +01:00
Gleb Mazovetskiy 124d113b57 Extract spell data to a TSV 2023-12-05 21:33:23 +01:00
Gleb Mazovetskiy 17f95a04da Migrate missile sprite data to txtdata 2023-11-18 17:33:14 +00:00
Gleb Mazovetskiy f566359e4f Migrate item data to txtdata/ 2023-11-14 00:20:17 +00:00
Gleb Mazovetskiy 2eae121931 Migrate monstdat to a data file
We may want to migrate this to 1 file per monster but for now the
migration is as close to the hard-coded version as possible.

Sprites that are used by multiple monsters are only loaded from disk
once.
2023-11-10 06:01:40 +00:00
ephphatha 3b458376bb Use a pointer to a player instance instead of network id for cursor hovering 2023-11-09 17:40:50 +01: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 5fc6ce608f Lua: Overhaul events
1. `Events` global is replaced with `require('devilutionx.events')`.
2. Table is simplified and documented.
3. `On` removed from the event names as it was a bit redundant.
4. Functions are camelCase for consistency (e.g. `add` instead of
   `Add`).

Example script:

```lua
local events = require("devilutionx.events")
local render = require("devilutionx.render")
local message = require("devilutionx.message")

local function greet()
  message("Hello from " .. _VERSION)
  print("Hello from ", _VERSION)
end
events.GameStart.add(greet)

local function drawGreet()
  render.string("Hello from " .. _VERSION, 10, 40)
end
events.GameDrawComplete.add(drawGreet)
```
2023-11-07 02:44:10 +00:00
Gleb Mazovetskiy c5a5dc9f5c Fix a few MSVC warnings 2023-11-05 12:57:59 +00:00
Anders Jenbo bb2e189327 Convert _sfx_id in to class enum 2023-11-02 14:34:24 +01:00
Gleb Mazovetskiy 17d5f05ada Fix some compilation warnings 2023-11-02 00:42:44 +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
lithraal 8b141d927b Automap: Don't close automap when pressing spacebar with other windows open (#6713)
* GameMenu: Add a flag to notify that game menu is on/off

This patch adds a simple flag so other source files can see if game menu
is currently off or on.

* Automap: Don't close automap when pressing space with other windows open

Currently if we open a lot of windows and have automap enabled, and we
press space - all of the windows along with automap get closed. This
patch removes that, and allows to close automap with spacebar, but only
if every window is closed.
2023-10-30 02:42:55 +01: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
Gleb Mazovetskiy 09ab58343c Migrate gold drop/withdrawal to text_input
With this, all text input is handled in a unified way.
2023-10-24 20:11:04 +01:00
Gleb Mazovetskiy fdb5738815 Add cursor support to DiabloUI and chat
Supports move left/right/home/end, backspace, delete, and Ctrl+V.
2023-10-24 01:56:54 +01:00
9123f01a96 Hotkeys: Support more keybindings (#6719)
* Extend F keys with F13-F24 range
* Add more possible keybindings
* Removed hardcoded keys that are used elsewhere
* Put PAUSE back where it was before
* Remove hardcoded logic for PAUSE key
* Hotkeys: Support more keybindings

This patch adds more keybindings, so we can map multiple keys.

It also adds a possibility to bind an alternate key to pause game
(currently mapped to P and Pause key by default).

Co-authored-by: n <[email protected]>
Co-authored-by: staphen <[email protected]>
2023-10-17 18:16:17 +02:00
tetektoza e0291b6f58 HotkeyMessages: Add more quick message slots
Resolves https://github.com/diasurgical/devilutionX/issues/6542

Currently we only have 4 quick message slots, this patch adds more of
them resizing the total amount to 10.
2023-10-16 05:20:43 +02: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
Anders Jenbo 706010ee45 Add Lua support 2023-10-08 21:33:51 +02:00
Anders Jenbo d725fdb4f3 Add screen reader support 2023-09-24 14:16:39 +02:00
Gleb Mazovetskiy 848f234aed Add automap type cycling controls
Makes cycling the automap type separate from toggling it on/off.

The TAB key can still be used for quick on/off as usual, while
the new Cycle key ("m" by default) can be used to switch between available
display types.

`Get/NextDebugMonster` debug keybind changed to "v" to avoid a conflict.
2023-09-20 04:50:52 +01:00
staphen 7e489a88af Load stash data based on gbIsHellfire, not gbIsHellfireSaveGame 2023-09-05 05:05:35 +02:00
Anders Jenbo 15ed246239 Merge branch 'master' of github.com:diasurgical/devilutionX into development 2023-08-26 01:09:03 +02:00
KPhoenix cb5537083d Fix right click during dialogue 2023-08-26 01:05:05 +02:00
ephphathaandGleb Mazovetskiy 32c3316743 Load experience data from file
Also added an iterator based API, though it's not useful for this use-case. Might be nice in the future?

The field/record iterators is single-pass input iterators with shared state.
To avoid rescanning fields unnecessarily parseInt currently can only be called once, it would be possible to make these iterators bidirectional with a bit of extra state (holding onto the start pointer)

Co-authored-by: Gleb Mazovetskiy <[email protected]>
2023-08-24 05:46:44 +02:00
ephphatha da76e131e4 Add getter/setter for character levels to ensure _pNextExper stays synced 2023-08-24 05:46:44 +02: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 d5446f2f01 Use std::variant in StringOrView
We also add a direct string move-assignment (`operator=(std::string &&)`),
which results in better codegen.

As a consequence, we have to replace `= {}` assignments with `= StringOrView {}`
because `= {}` is now ambiguous.
2023-08-14 10:55:02 +01:00
Gleb Mazovetskiy 8c1a847f41 Remove utils/stdcompat/string_view.hpp 2023-08-14 09:59:14 +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 MazovetskiyandStephen C. Wills 9d96eea86b De-duplicate extra fonts version check code
Co-authored-by: Stephen C. Wills <[email protected]>
2023-07-16 06:02:19 +02:00
staphen 22fdeaf2f0 Use JNI to check VERSION file in fonts.mpq 2023-07-16 06:02:19 +02:00
Gleb Mazovetskiy d6b7949dab Fonts: Use pre-cropped CLX sprites
Built-in font size decreased by 121,587 bytes
(2,287,332 -> 2,165,745).

Fixes #6361
2023-07-16 06:02:19 +02:00
staphen 2068d66c85 Stop streaming sfx when exiting the game 2023-07-09 22:05:42 +02:00
Anders Jenbo 01a7966f1d Empty cursor when closing inventory
Fixes #4205
2023-06-03 20:25:50 +02:00
DakkJaniels e485493a3d Fix print screen for different print screen key bindings (#6060) 2023-05-26 06:20:54 +02:00
qndel 88e7c8feec get rid of hardcoded ALT in variable/function name 2023-05-18 22:54:41 +02: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
staphen 22dacbd819 Load deltas after saving pre-lighting data 2023-05-07 13:32:09 +02:00
obligaron 2570c2d240 Don't recalculate player position when loading a game 2023-05-06 17:59:10 +02:00
Anders Jenbo 5a12f7b0d5 Always spawn players in a valid location 2023-04-29 15:34:41 -04:00
DakkJaniels b0cb925a5e Add print screen to event handler for UI (#6058) 2023-04-28 20:20:32 +02:00
Anders Jenbo 12fa487cb5 Fix build 2023-04-24 17:57:11 +02:00
qndel d97f265cb1 light fix 2023-04-24 17:22:00 +02:00
Anders Jenbo 13c5c09990 Clean up Light related naming
A few are left unchanged as they will be removed in a later commit
2023-04-21 21:25:19 +02:00
obligaron 1a3e72bf17 Unify normal casting and casting from inventory 2023-04-17 03:22:50 +02:00