View Single Post
Old 16-04-17, 21:45   #10
annl
Archaeologist
 
annl's Avatar
 
Join Date: Feb 2012
Location: In my bedroom (most likely).
Posts: 1,470
Default

Quote:
Originally Posted by Arsunt View Post
I've uploaded TR3 exe for GOG and for Steam with my (exclusive) FOV patch. It was was not published anywhere until now.

That's how it works. There is the original code (let it be C pseudocode):
Code:
#define SCREEN_WIDTH    dword_5A6AF4
#define SCREEN_HEIGHT    dword_4D790C
#define ASPECT_RATIO    flt_4C3244    // 1.3333334

void sub_402030(__int16 a1) {
    int v1, v2, v3;

    v1 = SCREEN_WIDTH / 2 * sub_4B4C58(a1 / 2);
    v2 = sub_4B4C5E(a1 / 2);
    dword_4F6D50 = v1 / v2;

    v3 = sub_4B5E10(v2, v1 % v2, flt_4C5084);
    dword_5A6A28 = v3 / dword_4F6D50;

    flt_5A6AB8 = (double)dword_4F6D50; // heigth ratio
    flt_4F6D48 = flt_4C5084 / flt_5A6AB8; // depth ratio
    flt_53170C = flt_5A6AB8 / flt_56C0A0;

    flt_4D38D8 = 1.3333334 / ((double)SCREEN_WIDTH / (double)SCREEN_HEIGHT);

    sub_48D6A0(v3 % dword_4F6D50);
}
And I've changed it to this code:
Code:
#define SCREEN_WIDTH    dword_5A6AF4
#define SCREEN_HEIGHT    dword_4D790C
#define ASPECT_RATIO    flt_4C3244    // 1.3333334

const float flt_4D38D8 = 1.0;    // it is always 1.0 now

int sub_4020B8() {
    return (int)((float)SCREEN_HEIGHT * ASPECT_RATIO)
}

void sub_402030(__int16 a1) {
    int v1, v2, v3;

    // SCREEN_WIDTH value replaced by new function sub_4020B8
    v1 = sub_4020B8 / 2 * sub_4B4C58(a1 / 2);
    v2 = sub_4B4C5E(a1 / 2);
    dword_4F6D50 = v1 / v2;

    v3 = sub_4B5E10(v2, v1 % v2, flt_4C5084);
    dword_5A6A28 = v3 / dword_4F6D50;

    flt_5A6AB8 = (double)dword_4F6D50; // heigth ratio
    flt_4F6D48 = flt_4C5084 / flt_5A6AB8; // depth ratio
    flt_53170C = flt_5A6AB8 / flt_56C0A0;

    sub_48D6A0(v3 % dword_4F6D50);
}
There are v1, v2, v3 variables to calculate FOV. I changed the formula so that they depended on the original aspect ratio (4/3) and the current screen height, but NOT screen width, because this is not correct for wide screens.

The flt_4D38D8 variable is pixel aspect ratio. It must always be 1.0 if we want correct aspect ratio.

P.S. Do not combine this patch with other Widescreen patches and Peixoto's patch. They will break the formula.
Fantastic work Arsunt! Works fantastic! Can you do one for TR3 Gold too? Also message AlexFly, get this uploaded on his website! It's your choice, but many people have the same problem I had.

EDIT: The FMVs are not working well now, the sounds loop and then the FMV cuts off and auto skips halfway, what is wrong?
__________________
Mods: TR1 Sound Overhaul, TR2 Remixed, TR3 Transformed and TR4 HD.

Last edited by annl; 16-04-17 at 22:00.
annl is offline   Reply With Quote