WASD movement for the player

While W/A/S/D are held, the controlled creature gets a plain walk order every
engine tick toward its position plus the pressed screen direction, as the
mouse does while its button is held (every mouse event re-sends a walk to the
cursor point); releasing sends the target-less stop order of a released mouse
button. W/A/S/D key events are swallowed before the hotkeys see them; their
old actions move to G (action slot 3), V (pick up nearby) and K (save game
window) for now, configurable in [wasd].

docs/wasd.md: order format, measured mouse behaviour, hotkey map.
docs/todo.md: better pathfinder; final bindings for the moved hotkeys.
re::ConfigString for string settings.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
khallaandClaude Opus 5.5 committed 2026-10-14 09:08:53 +02:00
1 parent 52db0f79f9
commit aa7d49409c
6 files changed
+425

No files matched your search

+13
View File
@@ -1,6 +1,7 @@
#include "re/config.h"
#include <cstring>
#include <iterator>
#include <windows.h>
@@ -34,4 +35,16 @@ int ConfigInt(const char* section, const char* key, int fallback) {
return static_cast<int>(GetPrivateProfileIntW(Widen(section).c_str(), Widen(key).c_str(), fallback, g_path.c_str()));
}
std::string ConfigString(const char* section, const char* key, const char* fallback) {
if (g_path.empty()) {
return fallback;
}
wchar_t value[256];
GetPrivateProfileStringW(Widen(section).c_str(), Widen(key).c_str(), Widen(fallback).c_str(), value,
static_cast<DWORD>(std::size(value)), g_path.c_str());
char narrow[256];
WideCharToMultiByte(CP_UTF8, 0, value, -1, narrow, sizeof(narrow), nullptr, nullptr);
return narrow;
}
} // namespace re