HUD: centre the taskbar, move the portrait/health panel to the right edge

New mods/hud: while a HUD window renders, screen-space vertices passed to
D3D7 DrawPrimitive/DrawIndexedPrimitive are shifted by dx; while it handles
an event, the UI event point (category 5, +0x48) is shifted by -dx. Applied
to cUI_Taskbar2 (centred) and cUI_Mercenary (portrait + health, right edge).
3D belt items line up without help (their projection is screen-centred).
re::AttachRuntimeHook hooks functions only known at runtime (COM methods).

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 03:37:05 +02:00
1 parent f73c4154ad
commit ed3163d312
8 files changed
+259 -1

No files matched your search

+7
View File
@@ -23,6 +23,8 @@
#include "mods/widescreen.h"
#include "mods/hud.h"
#include <algorithm>
#include <atomic>
#include <bit>
@@ -284,6 +286,10 @@ void ApplyRenderSize(game::DxDisplayMode& mode, HWND window) {
re::Log("widescreen: render size %dx%d, ortho x +-%.1f y +-%.1f", width, height, g_orthoRight, g_orthoTop);
}
int RenderWidth() {
return g_renderWidth;
}
bool IsClassicFrame() {
if (g_renderWidth == 0) {
return false;
@@ -317,6 +323,7 @@ void __fastcall DxDriver7_LoadingScreen(DxDriver7* self, void* edx, uint32_t pro
// viewport (the borderless mod then presents just that area, scaled), and the
// world the full render size.
int __fastcall DxDriver7_BeginScene(DxDriver7* self, void* edx) {
mods::hud::OnDevice(self->device);
if (g_renderWidth != 0 && self->sceneDepth == 0 && self->device) {
const bool classic = IsClassicFrame();
Viewport7 viewport = {0, 0, classic ? 1024u : static_cast<DWORD>(g_renderWidth),