HUD: centre all UI windows, shift mouse events (not UI commands)

Generic cUI_Window2 hooks centre dialogs, inventory, maps, traders and the
ESC menu. Event shifting now targets the cursor position of mouse events
(move/down/up, x at +8) instead of category 5 UI events, whose +0x48 is not
a point for commands such as opening the ESC menu.

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 04:01:35 +02:00
1 parent ed3163d312
commit a640f2fb17
3 files changed
+139 -46

No files matched your search

+10
View File
@@ -65,6 +65,9 @@ int g_renderHeight = 0;
// Frames from the main menu thread and the loading screen are laid out for
// 1024x768 ("classic"); everything else is the widened in-game view.
std::atomic<DWORD> g_menuThread = 0;
// Whether the most recent scene (on any thread) was a classic one: the main
// menu is showing. UI input is processed outside the menu thread.
std::atomic<bool> g_lastSceneClassic = false;
thread_local int g_loadingScreenDepth = 0;
// D3DVIEWPORT7 (d3d.h is not in current Windows SDKs).
@@ -290,6 +293,10 @@ int RenderWidth() {
return g_renderWidth;
}
bool MenuIsShowing() {
return g_lastSceneClassic;
}
bool IsClassicFrame() {
if (g_renderWidth == 0) {
return false;
@@ -324,6 +331,9 @@ void __fastcall DxDriver7_LoadingScreen(DxDriver7* self, void* edx, uint32_t pro
// world the full render size.
int __fastcall DxDriver7_BeginScene(DxDriver7* self, void* edx) {
mods::hud::OnDevice(self->device);
if (self->sceneDepth == 0) {
g_lastSceneClassic = IsClassicFrame();
}
if (g_renderWidth != 0 && self->sceneDepth == 0 && self->device) {
const bool classic = IsClassicFrame();
Viewport7 viewport = {0, 0, classic ? 1024u : static_cast<DWORD>(g_renderWidth),