66 Commits
Author SHA1 Message Date
Anders Jenbo 005e7dcc23 chore: clang-tidy cleanup part 1 2026-04-03 22:57:48 +02:00
Anders Jenboandstaphen 6f319978e6 Migrate from libmpq to mpqfs (#8482)
Co-authored-by: staphen <[email protected]>
2026-03-30 00:14:11 +02:00
Yuri Pourre b684fd143c Adria refill mana as mod 2026-01-12 11:46:11 +00:00
Anders Jenbo a60768a73f SDL3: Backport to SDL 3.2.0 2025-10-10 15:54:19 +02:00
Gleb Mazovetskiy 1bbe8bfe08 SDL3: Even more migration 2025-10-09 01:28:37 +01:00
Gleb Mazovetskiy 3bcc869d85 Replace fmt with utils/str_cat in a few places
`fmt::format_to` is overkill for our simple formatting needs.
2025-09-29 08:36:34 +01:00
Anders Jenbo 1c76897f2c Apply simple const rules using clang-tidy 2025-08-16 01:21:36 +02:00
Gleb Mazovetskiy d3248e969a Untangle more dependencies
This allows us to make `clx_render_benchmark` and
`text_render_integration_test` standalone.
2025-07-20 14:11:36 +01:00
staphen 88b39dc97d Make use of SDL_UserEvent::code instead of SDL_Event::type 2025-05-24 19:56:38 +02:00
Gleb Mazovetskiy 3bb1d685af Extract current input mode into its own library
Removes a transitive dependency on the entire plrctrl from options.
2025-01-22 23:14:45 +00:00
Gleb Mazovetskiy d94bc424df sgOptions -> GetOptions()
In C++, globals initialization order accross translation units is not
defined. Accessing a global via a function ensures that it is initialized.

This will be needed for #7638, which will statically initialize change
handlers after the Options object has been initialized.
2025-01-13 11:57:25 +00:00
Anders Jenbo 908fb47073 Merge limitFPS and vSync options (#7646) 2025-01-12 15:28:50 +01:00
Gleb Mazovetskiy a7651f15d9 Extract HeadlessMode from diablo.h
Untangles some dependencies.
Many places that use `HeadlessMode` do not need all of `diablo.h`.
2025-01-09 12:21:26 +00:00
Gleb Mazovetskiy a49b1f2d58 Extract Is{Any,None}Of out of engine.hpp
Untangles some of the dependencies
2025-01-08 09:54:56 +09:00
qndel 24f108f193 fix many typos (#7322) 2024-08-09 21:13:42 +02:00
Gleb Mazovetskiy 15791ee6ad Demomode: Set scancode for keyboard events
We were previously not setting it all which was incorrect but did not
cause any issues because we had not used it. We do check scancode for
the debug console key. This caused a sanitizer warning when running the
demo in debug mode.
2024-05-04 23:06:38 +09:00
Gleb Mazovetskiy 70ff515f48 Stream demo messages
This entirely eliminates the demo memory overhead.
2023-09-02 20:54:24 +01:00
Gleb Mazovetskiy 65e0ad88d2 Further reduce demo file size
The vast majority of events are rendering events:

 Type        | Count
-------------|------:
 Rendering   | 58,971
 MouseMotion | 19,651
 GameTick    |  6,414
 MouseButton |    516
 Key         |      7
 Custom      |      1

Encodes Rendering events in a single byte when possible.

Demo file size: 253,410 bytes -> 194,439 bytes
2023-09-02 16:43:59 +01:00
Gleb Mazovetskiy d31a7b5c2c Log Demo settings 2023-09-01 21:59:20 +01:00
Stephen C. Wills 5e778431c3 Deterministic timer simulation for shrine messages in demo mode (#6516) 2023-08-29 13:46:49 +02:00
Gleb Mazovetskiy eb51a8beb3 Reduce demo message size
`DemoMsg` struct and event data are now kept separately.

RAM usage for the timedemo messages: -85% (1.8 MiB -> 261 KiB)

Demo (`.dmo`) file size: -57% (590,790 bytes -> 253,410 bytes)
2023-08-27 16:49:13 +01:00
Gleb Mazovetskiy c19bfe87fa Remove utils/stdcompat/algorithm.hpp 2023-08-14 01:54:29 +01:00
Anders Jenbo 64d7af2937 Fix loading new demo files and give better error messages when failing 2023-07-24 02:45:26 +02:00
Gleb Mazovetskiy 936b3bd45a Demomode: Store/override gameplay options 2023-06-16 18:49:14 +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
Gleb Mazovetskiy c5e6bf630f demomode.cpp: Set mouse.*.which to 0
Otherwise it can end up as `-1`, triggering the `VirtualGamepad` input
type (-1 is `SDL_TOUCH_MOUSEID`).
2023-03-21 17:04:01 +00: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
Gleb Mazovetskiy 1788d2f8ec Remove miniwin
Event handling code moved to `engine/events.{hpp,cpp}`.
2023-02-01 16:06:57 +00:00
Gleb Mazovetskiy 5bf9dfd7ee Demo mode: Force resolution to that of the demo 2023-01-12 03:38:29 +00:00
qndel efaf334965 typos and code cleanup 2022-12-19 17:34:15 +01:00
Gleb Mazovetskiy 9b1ff3d50b demomode.cpp: Fix creating a bogus event
The `eof()` does not return true until a failed read attempt.

> Note that the value returned by this function depends on the last operation performed on the stream (and not on the next).
2022-12-15 05:59:17 +01:00
Gleb Mazovetskiy 45757856c1 DemoMode: Add a debug define to log events 2022-12-15 05:59:17 +01:00
obligaron 5180bd02b4 Timedemo: don't update ProgressToNextGameTick in pause menu 2022-12-15 05:37:33 +01:00
obligaron 028f630848 Timedemo: don't play and record messages in loading screens 2022-12-15 05:37:33 +01:00
obligaron 6e08ad658f Timedemo: represent game tick progress as uint8_t 2022-12-15 05:37:33 +01:00
Gleb Mazovetskiy cffb2566df Fix timedemo on SDL1 2022-12-09 12:05:54 +01:00
Gleb Mazovetskiy ab5733b5e3 Support demo playback in SDL1
Useful for measuring performance in SDL1.
The demomode test now passes in SDL1 as well.
2022-11-23 18:05:50 +00:00
obligaron eca1a68bec AnimationInfo: Use fixed point math for fractions 2022-11-06 12:31:40 +00: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 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
obligaron 2c7e886c85 Add detail log info to CompareSaves 2022-08-02 02:12:36 +02:00
Gleb Mazovetskiy 7c0b72abc0 Improve demo test error message
Example:

```
file "game" is different at byte 54251:
Expected: ... 00 00 00 00 00 00 00 00 30 00 00 00 50 00 00 00 ...
  Actual: ... FF FF FF FF 00 00 00 00 30 00 00 00 50 00 00 00 ...
```
2022-07-26 01:20:06 +02:00
Gleb Mazovetskiy adf40f5c80 misc_msg: Always use lParam for mod state
Previously, keyboard events used `lParam` for modifier key state,
while mouse events used `wParam`.

Changes the mouse events to use `lParam`, which allows us to
change `lParam` to `uint16_t`.

Demo migrated with a script.
2022-07-18 11:09:45 +01:00
Gleb Mazovetskiy 4c1dbaba72 Demo mode: Handle endianness 2022-07-18 10:35:27 +01:00
Gleb Mazovetskiy ea1087dfeb Use StrCat in a few more places
Now `fmt` is only used for more complex formatting and for translations.
2022-07-17 20:43:00 +02:00
Gleb Mazovetskiy a4ac41cece Replace DVL_VK virtual key codes with SDLK 2022-07-17 10:00:06 +01:00
Anders Jenbo ac2bf9aaac Limit what gets called in headless mode 2022-07-13 18:54:36 +02:00
obligaron ebfb519ee0 Rename gbQuietMode to HeadlessMode 2022-07-13 18:54:36 +02:00
obligaron bab9baa42a Handle gbQuietMode for paths in StartGame 2022-07-13 18:54:36 +02:00
Anders Jenbo 3ae834148a Split event handeling from general miniwin features 2022-07-10 21:13:39 +02:00