1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-15 06:04:49 +01:00

some more maintas tweaks

This commit is contained in:
FunkyFr3sh 2023-12-31 04:35:08 +01:00
parent a863d8cb33
commit 3e4833bda7
3 changed files with 11 additions and 11 deletions

View File

@ -804,16 +804,16 @@ HRESULT dd_SetDisplayMode(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwFl
}
else if (g_config.maintas)
{
float dst_ar = (float)g_ddraw->height / g_ddraw->width;
float src_ar = (float)g_ddraw->render.height / g_ddraw->render.width;
double dst_ar = (double)g_ddraw->height / g_ddraw->width;
double src_ar = (double)g_ddraw->render.height / g_ddraw->render.width;
g_ddraw->render.viewport.width = g_ddraw->render.width;
g_ddraw->render.viewport.height = (int)roundf(dst_ar * g_ddraw->render.viewport.width);
g_ddraw->render.viewport.height = (int)round(dst_ar * g_ddraw->render.viewport.width);
if (src_ar < dst_ar)
{
g_ddraw->render.viewport.width =
(int)roundf(((float)g_ddraw->render.viewport.width / g_ddraw->render.viewport.height) * g_ddraw->render.height);
(int)round(((double)g_ddraw->render.viewport.width / g_ddraw->render.viewport.height) * g_ddraw->render.height);
g_ddraw->render.viewport.height = g_ddraw->render.height;
}

View File

@ -382,11 +382,11 @@ void util_toggle_maximize()
dst_rc.top = 0;
dst_rc.left = 0;
dst_rc.right = w;
dst_rc.bottom = (LONG)(((float)g_ddraw->height / g_ddraw->width) * w);
dst_rc.bottom = (LONG)round(((double)g_ddraw->height / g_ddraw->width) * w);
if (dst_rc.bottom > h)
{
dst_rc.right = (LONG)(((float)dst_rc.right / dst_rc.bottom) * h);
dst_rc.right = (LONG)round(((double)dst_rc.right / dst_rc.bottom) * h);
dst_rc.bottom = h;
}

View File

@ -314,8 +314,8 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
real_GetWindowLongA(hWnd, GWL_EXSTYLE)) &&
SetRect(&clientrc, 0, 0, clientrc.right - clientrc.left, clientrc.bottom - clientrc.top))
{
float scaleH = (float)g_ddraw->height / g_ddraw->width;
float scaleW = (float)g_ddraw->width / g_ddraw->height;
double scaleH = (double)g_ddraw->height / g_ddraw->width;
double scaleW = (double)g_ddraw->width / g_ddraw->height;
switch (wParam)
{
@ -324,19 +324,19 @@ LRESULT CALLBACK fake_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
case WMSZ_LEFT:
case WMSZ_RIGHT:
{
windowrc->bottom += (LONG)(scaleH * clientrc.right - clientrc.bottom);
windowrc->bottom += (LONG)round(scaleH * clientrc.right - clientrc.bottom);
break;
}
case WMSZ_TOP:
case WMSZ_BOTTOM:
{
windowrc->right += (LONG)(scaleW * clientrc.bottom - clientrc.right);
windowrc->right += (LONG)round(scaleW * clientrc.bottom - clientrc.right);
break;
}
case WMSZ_TOPRIGHT:
case WMSZ_TOPLEFT:
{
windowrc->top -= (LONG)(scaleH * clientrc.right - clientrc.bottom);
windowrc->top -= (LONG)round(scaleH * clientrc.right - clientrc.bottom);
break;
}
}