widescreen: draw creatures across the whole view; HUD: copy the cursor per thread

- Creatures were culled beyond 1024+200 x 768+200 screen pixels (cmp 4C8h /
  3C8h in both object passes): invisible in the right part of a wide view,
  and the player too once the centre passed 1224. The bounds follow the
  render size now.
- Centre immediates written as negatives (-200h / -180h), missed before:
  the row renderer's static object origin (0x62babb) and aiming at the
  cursor (0x4fb620).
- HUD: moved windows no longer shift the shared mouse cursor object; the
  cursor accessor (0x6550f0) hands them a per-thread shifted copy and writes
  back what they changed. World input on other threads read the shifted
  position now and then, which made hold-to-move jerky.

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 08:16:27 +02:00
1 parent ba03672c32
commit d39f12ab4b
6 files changed
+145 -33

No files matched your search

+21 -1
View File
@@ -185,8 +185,27 @@ void PatchCenterImmediates(int width, int height) {
patched += re::PatchInstructionDword(pair[0], 0x200, static_cast<uint32_t>(width / 2));
patched += re::PatchInstructionDword(pair[1], 0x180, static_cast<uint32_t>(height / 2));
}
for (const auto& pair : game::addr::kNegativeCenterImmediates) {
patched += re::PatchInstructionDword(pair[0], static_cast<uint32_t>(-0x200), static_cast<uint32_t>(-(width / 2)));
patched += re::PatchInstructionDword(pair[1], static_cast<uint32_t>(-0x180), static_cast<uint32_t>(-(height / 2)));
}
re::Log("widescreen: %d/%d screen centre immediates patched", patched,
static_cast<int>(std::size(game::addr::kCenterImmediates)) * 2);
static_cast<int>(std::size(game::addr::kCenterImmediates) + std::size(game::addr::kNegativeCenterImmediates)) *
2);
}
// Creatures beyond the original screen (plus a margin) are not drawn.
void PatchCreatureClip(int width, int height) {
using namespace game::addr;
int patched = 0;
for (uint32_t site : kCreatureClipRight) {
patched += re::PatchInstructionDword(site, 1024 + kCreatureClipMargin, width + kCreatureClipMargin);
}
for (uint32_t site : kCreatureClipBottom) {
patched += re::PatchInstructionDword(site, 768 + kCreatureClipMargin, height + kCreatureClipMargin);
}
re::Log("widescreen: %d/%d creature clip immediates patched", patched,
static_cast<int>(std::size(kCreatureClipRight) + std::size(kCreatureClipBottom)));
}
uint32_t FloatBits(float value) {
@@ -295,6 +314,7 @@ void ApplyRenderSize(game::DxDisplayMode& mode, HWND window) {
g_viewInvHeight = 1.0f / height;
if (!g_pushesPatched) {
PatchCenterImmediates(width, height);
PatchCreatureClip(width, height);
PatchGrannyOrthoPushes(width, height);
PatchLabelArea(width, height);
PatchLetterbox(width);