widescreen: label areas and remaining world->screen centres
- Alt object labels and floating texts are packed into a 1024x768 area (push 300h/400h at 0x6272f8 and 0x60e940): widened to the render size. - Screen centre immediates in the light/effect position list (0x41b1xx..) and the floating text (damage number) projection 0x41e460/0x41eaf0 now use the render centre; lights were offset from the player before. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
6f10ccdfad
commit
52c67f51c6
2 files changed
+22
No files matched your search
@@ -78,6 +78,11 @@ constexpr uint32_t kCenterImmediates[][2] = {
|
||||
{0x0062b4c6, 0x0062b4e9}, {0x0062cc40, 0x0062cc50}, {0x0062dcc6, 0x0062dce1},
|
||||
{0x0062e398, 0x0062e3a9}, {0x0062f967, 0x0062f96d}, {0x0062fe60, 0x0062fe7d},
|
||||
{0x006315aa, 0x006315b0}, {0x00631aca, 0x00631ae7}, {0x00631c53, 0x00631c70},
|
||||
// screen positions stored for later (list at +0xce14, up to 1024 entries)
|
||||
{0x0041b184, 0x0041b1a1}, {0x0041b25c, 0x0041b27e}, {0x0041b3f6, 0x0041b3e4},
|
||||
{0x0041b4d6, 0x0041b4c4},
|
||||
// floating texts (damage numbers): world -> screen, and back (sub)
|
||||
{0x0041e560, 0x0041e596}, {0x0041eb07, 0x0041eaf7},
|
||||
};
|
||||
|
||||
// cWorldView0 is allocated with `push 970F4h; call operator new` here.
|
||||
@@ -138,4 +143,9 @@ constexpr uint32_t kOrthoPushSequences[] = {
|
||||
// uses the (redirected) view width with it.
|
||||
constexpr uint32_t kGrannyOrthoPushSequences[] = {0x0040ebc9, 0x0040f5cf, 0x0040feff, 0x006f1ecb};
|
||||
|
||||
// Screen-space labels (object names on Alt, floating texts) are packed without
|
||||
// overlap into a screen-sized area (0x662300), constructed with push 768 /
|
||||
// push 1024: the height push, the width push follows 5 bytes later.
|
||||
constexpr uint32_t kLabelAreaPushes[] = {0x006272f8, 0x0060e940};
|
||||
|
||||
} // namespace game::addr
|
||||
@@ -225,6 +225,17 @@ void PatchGrannyOrthoPushes(int width, int height) {
|
||||
static_cast<int>(std::size(game::addr::kGrannyOrthoPushSequences)) * 4);
|
||||
}
|
||||
|
||||
// Labels are laid out within the screen; widen their area.
|
||||
void PatchLabelArea(int width, int height) {
|
||||
int patched = 0;
|
||||
for (uint32_t site : game::addr::kLabelAreaPushes) {
|
||||
patched += re::PatchPushImm32(site + 0, 0x300, static_cast<uint32_t>(height));
|
||||
patched += re::PatchPushImm32(site + 5, 0x400, static_cast<uint32_t>(width));
|
||||
}
|
||||
re::Log("widescreen: %d/%d label area immediates patched", patched,
|
||||
static_cast<int>(std::size(game::addr::kLabelAreaPushes)) * 2);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void ApplyRenderSize(game::DxDisplayMode& mode, HWND window) {
|
||||
@@ -275,6 +286,7 @@ void ApplyRenderSize(game::DxDisplayMode& mode, HWND window) {
|
||||
if (!g_pushesPatched) {
|
||||
PatchCenterImmediates(width, height);
|
||||
PatchGrannyOrthoPushes(width, height);
|
||||
PatchLabelArea(width, height);
|
||||
}
|
||||
const double scaleX = width / kOriginalWidth;
|
||||
const double scaleY = height / kOriginalHeight;
|
||||
|
||||
Reference in new issue
Block a user