Commit Graph
89 Commits
Author SHA1 Message Date
Gleb Mazovetskiy 4e9bb0e704 Fix gold withdrawal in SDL1
1. Unifies SDL1 and SDL2 text input handling.
2. Moves game-specific text input handling out of misc_msg.
3. Disables Unicode processing when not inputting text in SDL1.

This fixes gold withdrawal in SDL1.
2022-11-27 20:09:54 +00:00
staphen 28a9f0e8b5 Forward SDL_JOYHATMOTION events in FetchMessage_Real() 2022-10-31 10:29:37 +01:00
staphen b8ceade79e Forward touch events from FetchMessage_Real() 2022-10-23 06:11:44 +01:00
staphen 0f74370a99 Move gamepad logic from FetchMessage() to GameEventHandler() 2022-10-17 01:01:21 +02:00
staphen e67e4934cc Add padmapper for gamepad customization 2022-10-17 01:01:21 +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 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 79e23f26f2 misc_msg: Encode keyboard mod state directly
`demo_0.dmo` migrated with a script
2022-07-17 18:48:47 +01:00
Gleb Mazovetskiy 3d4f0b48b8 Remove TranslateMessage
It has become entirely redundant.
2022-07-17 11:44:52 +02:00
Gleb Mazovetskiy a4ac41cece Replace DVL_VK virtual key codes with SDLK 2022-07-17 10:00:06 +01:00
Gleb Mazovetskiy 70364013b0 Fix fmt v9 deprecation warnings
Version 9 of libfmt deprecates printing `enum` without casting it to an
integral type explicitly (consistent with `enum class`).
2022-07-16 12:55:18 +01:00
Anders Jenbo 3ae834148a Split event handeling from general miniwin features 2022-07-10 21:13:39 +02:00
Anders Jenbo a7be622aa3 Clean up naming of event handler 2022-07-10 21:13:39 +02:00
Gleb Mazovetskiy f22d1d0149 Remove uses of deprecated codecvt
codecvt is deprecated in C++17 and we don't really need all of its heavy
machinery for simply converting to UTF-8.
2022-06-16 13:54:29 +01:00
qndel 354e329644 Players[MyPlayerId] -> MyPlayer 2022-05-31 05:35:52 +02:00
Anders Jenbo dc706e8ed5 Use HoldItem for determining if an item is held
This cleans up a bit of code and solves a few edge cases where an item
could be lost, the game be unresponsive, or miss fire an event during
lag cause of the cursor not reflecting the currently held item.
2022-04-18 11:27:07 +02:00
Anders Jenbo b55ab39fe3 [ganepad] Do not repeat spell if modefier is pressed 2022-04-13 04:52:49 +02:00
Anders Jenbo 66d7a3c222 [gamepad] Reuse repeat logic from mouse 2022-04-13 02:13:31 +02:00
Gleb Mazovetskiy a8b7de498c Fix -Wswitch in misc_msg.cpp 2022-04-11 23:35:03 +02:00
Gleb Mazovetskiy 1209355a0b Reduce debug log output of misc_msg 2022-04-11 23:35:03 +02:00
Gleb Mazovetskiy 4c2fa76e49 Controller mouse emulation fixes
1. Do not interrupt mouse mode on virtual clicks.
2. Handle virtual clicks directly instead of sending an SDL event.
3. Fix D-Pad mouse emulation state handling.
4. Hides the modifier hints during D-Pad mouse emulation.
2022-04-09 04:17:39 +02:00
Gleb Mazovetskiy 79c7eee10a Mouse/Gamepad fixes
Introduces a `ControlDevice` global which is distinct from `ControlMode`
in that it is set to `Gamepad` even when simulating a mouse.

This allows us to avoid a number of edge cases related to mode changes.

Fixes #4242
2022-04-03 23:06:36 +01:00
Andrew James 028c5945b8 Add helpers to change stash pages (#4287) 2022-04-02 10:54:25 +02:00
staphen 6a30cd3950 Add gamepad support for stash 2022-03-30 23:12:09 +02:00
Anders Jenbo e2fef44c9f Close gold withdraw when closing stash 2022-03-27 18:08:02 +02:00
Anders Jenbo a48f89007d Implement stash 2022-03-18 06:01:53 +01:00
Anders Jenbo 422f2bae9d Fix build warnings 2022-03-15 04:39:14 +01:00
staphen e0a3c553b4 Add window focus logic for SDL1 2022-01-18 13:13:31 +01:00
obligaron b3a9760bda Keymapper: Add mouse support 2022-01-15 15:31:48 +01:00
Anders Jenbo b0252b3339 Make Gamepad cursor independant of hardware mouse
The gamepad cursor (inventory, spells etc) no longer relies on warping a
real mouse cursor. This should make things work better on platforms that
do not support this, like Wayland.
2022-01-02 11:37:38 +01:00
Anders Jenbo 576d946581 Allow use of touch to select world objects 2022-01-02 11:37:38 +01:00
Anders Jenbo 6b2481a76c Touch support on all SDL2 platforms 2022-01-02 11:37:38 +01:00
staphen 74a77666b9 Improve behavior of ToControllerButtonEvent() 2021-12-24 23:08:41 +01:00
obligaron 18fb40ee32 Settingsmenu: Implement KeyInput 2021-12-23 00:26:12 +01:00
Gleb Mazovetskiy b4afe50dd1 misc_msg.cpp: include order 2021-11-25 12:22:27 +01:00
Gleb Mazovetskiy db7c9d08f5 Move DoSpeedBook to the right header 2021-11-25 02:15:41 +00:00
Gleb MazovetskiyandAnders Jenbo 7e1fea6f76 clang-format all files in {Source,test}/
Also includes a few manual tweaks to comments and newlines for better results.

Co-authored-by: Anders Jenbo <[email protected]>
2021-11-24 23:44:12 +01:00
staphen 40cc894630 Force VIRTUAL_GAMEPAD=OFF when USE_SDL1=ON 2021-11-15 00:55:32 +01:00
Gleb Mazovetskiy e9a9daa794 DrawString: Stop allocating
Switch to a state-machine UTF-8 decoder from the branchless one.
This allows us to avoid copying the string on every `DrawString` call.
2021-11-07 04:17:50 +01:00
Gleb Mazovetskiy 3d308983a8 Migrate to libmpq
libmpq is a much simpler alternative to StormLib for reading MPQ archives.

We use our own fork of libmpq: https://github.com/diasurgical/libmpq

Impact:

* DevilutionX is now a lot more portable. Unlike StormLib, libmpq only
  needs platform-specific code for Windows.
* Locks around file access **removed** (instead we duplicate the file descriptor for streamed audio only).
* RAM usage is **300 KiB** lower than StormLib.
* Stripped release linux_x86_64 binary is **32 KiB** smaller.
* Amiga build now hangs instead of crashing.
2021-11-06 23:51:42 +00:00
Stephen C. Wills 423441c3dc Fix speedbook navigation on gamepad 2021-11-03 10:50:35 +01:00
obligaron 2158faadab Use SDL_StartTextInput for gold drop dialog 2021-10-27 00:06:30 +02:00
Anders Jenbo b3a9a2ddce [gamepad] Allow for mixed mode navigation in inventory 2021-10-20 05:08:45 +02:00
Yuri Pourre b8450dc792 Assign ctrl to drop items 2021-09-29 18:15:26 +02:00
Anders Jenbo 7959b04573 SDL1 Unicode input support 2021-09-24 03:03:58 +02:00
Anders Jenbo 704a04ae4d Add support for Unicode fonts 2021-09-24 03:03:58 +02:00
obligaron 98eb863ea1 Use SDL Textinput for ingame chat 2021-09-21 21:03:01 +02:00
staphen 1b2d4d9478 Add comment to logic that skips handling touch-generated mouse events 2021-09-16 19:25:31 +02:00
staphen 3df85b70ce Add virtual gamepad event handlers and implement touch controls 2021-09-16 19:25:31 +02:00
staphen b29141048a Move existing touch control logic to Vita platform 2021-09-16 19:25:31 +02:00