Options: tabs Allgemein / Beute / Tastenbelegung with key bindings

- Options window in three tabs; the auto-pickup settings move to Beute;
  sliders move with their page; black sides like the save game screen.
- Tastenbelegung: every binding settable (click, press key; Esc cancels,
  Backspace unbinds), "Alle zurücksetzen" as a game button, saved on OK.
- Potions bindable (default unbound), named by the game's potion texts; the
  game's own potion hotkeys are off; bar tooltips show the bound key.
- Map (M), overview map (Tab, held) and labels (Alt, held) bindable; the
  game's own M / Tab / Alt handling is switched off.
- Save game key calls the game's save window code instead of a posted key.
- Teleportationstrank: fixed text replacement from startup (also the
  Ausdauertrank items, potion kind 5 as well).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
khallaandClaude Opus 5.5 committed 2026-10-19 00:38:34 +02:00
1 parent 72525cd5ba
commit 838b1aa491
27 files changed
+1423 -184

No files matched your search

+12 -13
View File
@@ -25,11 +25,10 @@
// Releasing the keys sends the target-less walk order a released mouse button
// sends, which stops it in place.
//
// W, A and S are game hotkeys; the key bindings (src/mods/input.cpp) keep
// W/A/S/D away from the game and move those actions to other keys. Typing into
// a text field (chat, console, save names) is left alone. See docs/wasd.md.
#include "mods/wasd.h"
// The movement keys are key bindings (default W/A/S/D, src/mods/input.cpp,
// which keeps them away from the game; the game's W/A/S actions moved to
// other keys). Typing into a text field (chat, console, save names) is left
// alone. See docs/wasd.md.
#include <atomic>
#include <cmath>
@@ -70,8 +69,11 @@ constexpr double kSlideAngles[] = {30.0, 60.0, 90.0};
constexpr uint32_t kEngineMouseHeld = 0x10;
constexpr uint32_t kEngineInputBlocked = 0x4000;
using mods::input::Move;
using mods::input::MovementKey;
bool KeyDown(int key) {
return (GetAsyncKeyState(key) & 0x8000) != 0;
return key != 0 && (GetAsyncKeyState(key) & 0x8000) != 0;
}
void SendWalk(uint8_t* engine, void* creature, int x, int y) {
@@ -110,10 +112,10 @@ bool HeldDirection(const uint8_t* engine, Direction& dir) {
int y = 0;
const uint32_t flags = *reinterpret_cast<const uint32_t*>(engine + kEngineFlags);
if ((flags & (kEngineMouseHeld | kEngineInputBlocked)) == 0 && !mods::input::TypingIntoTextField()) {
if (KeyDown('W')) { x -= 1; y -= 1; }
if (KeyDown('S')) { x += 1; y += 1; }
if (KeyDown('A')) { x -= 1; y += 1; }
if (KeyDown('D')) { x += 1; y -= 1; }
if (KeyDown(MovementKey(Move::Up))) { x -= 1; y -= 1; }
if (KeyDown(MovementKey(Move::Down))) { x += 1; y += 1; }
if (KeyDown(MovementKey(Move::Left))) { x -= 1; y += 1; }
if (KeyDown(MovementKey(Move::Right))) { x += 1; y -= 1; }
}
if (x == 0 && y == 0) {
return false;
@@ -213,9 +215,6 @@ struct Registration {
} // namespace
bool IsMovementKey(int vk) {
return (vk == 'W' || vk == 'A' || vk == 'S' || vk == 'D');
}
// Before each update of a creature: steer the controlled one.
void BeforeCreatureUpdate(uint8_t* creature) {