1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-24 17:49:52 +01:00

Revert "don't use min macro"

This reverts commit 3ac47313e2ad610049c0841e06a4e169782beeab.
This commit is contained in:
FunkyFr3sh 2022-09-09 11:26:53 +02:00
parent 3ac47313e2
commit 1e57228500
3 changed files with 13 additions and 14 deletions

View File

@ -36,7 +36,7 @@ void cfg_load()
g_ddraw->accurate_timers = cfg_get_bool("accuratetimers", FALSE); g_ddraw->accurate_timers = cfg_get_bool("accuratetimers", FALSE);
g_ddraw->resizable = cfg_get_bool("resizable", TRUE); g_ddraw->resizable = cfg_get_bool("resizable", TRUE);
g_ddraw->nonexclusive = cfg_get_bool("nonexclusive", FALSE); g_ddraw->nonexclusive = cfg_get_bool("nonexclusive", FALSE);
g_ddraw->fixpitch = cfg_get_bool("fixpitch", TRUE); g_ddraw->fixpitch = cfg_get_bool("fixpitch", FALSE);
g_ddraw->fixchilds = cfg_get_int("fixchilds", FIX_CHILDS_DETECT_PAINT); g_ddraw->fixchilds = cfg_get_int("fixchilds", FIX_CHILDS_DETECT_PAINT);
g_ddraw->fixwndprochook = cfg_get_bool("fixwndprochook", FALSE); g_ddraw->fixwndprochook = cfg_get_bool("fixwndprochook", FALSE);
g_ddraw->novidmem = cfg_get_bool("novidmem", FALSE); g_ddraw->novidmem = cfg_get_bool("novidmem", FALSE);
@ -332,7 +332,7 @@ static void cfg_create_ini()
"\n" "\n"
"; Fixes issues where the pitch of a surface is not a multiple of 4\n" "; Fixes issues where the pitch of a surface is not a multiple of 4\n"
"; Note: Enable this if some parts of the screen are being displayed diagonally\n" "; Note: Enable this if some parts of the screen are being displayed diagonally\n"
"fixpitch=true\n" "fixpitch=false\n"
"\n" "\n"
"; Force CPU0 affinity, avoids crashes/freezing, *might* have a performance impact\n" "; Force CPU0 affinity, avoids crashes/freezing, *might* have a performance impact\n"
"singlecpu=true\n" "singlecpu=true\n"

View File

@ -1030,17 +1030,16 @@ HRESULT dd_CreateSurface(
if (dst_surface->width && dst_surface->height) if (dst_surface->width && dst_surface->height)
{ {
DWORD bmp_width = dst_surface->width; if (dst_surface->width == 71 && dst_surface->height == 24) dst_surface->width = 72; //Commandos
DWORD bmp_height = dst_surface->height;
dst_surface->lx_pitch = dst_surface->bpp / 8; dst_surface->lx_pitch = dst_surface->bpp / 8;
dst_surface->l_pitch = bmp_width * dst_surface->lx_pitch; dst_surface->l_pitch = dst_surface->width * dst_surface->lx_pitch;
if (g_ddraw->fixpitch) if (g_ddraw->fixpitch && !(dst_surface->caps & (DDSCAPS_PRIMARYSURFACE | DDSCAPS_BACKBUFFER)))
{ {
while (dst_surface->l_pitch % 4) while (dst_surface->l_pitch % 4)
{ {
dst_surface->l_pitch = ++bmp_width * dst_surface->lx_pitch; dst_surface->l_pitch = ++dst_surface->width * dst_surface->lx_pitch;
} }
} }
@ -1048,8 +1047,8 @@ HRESULT dd_CreateSurface(
HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * 256); HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * 256);
dst_surface->bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); dst_surface->bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
dst_surface->bmi->bmiHeader.biWidth = bmp_width; dst_surface->bmi->bmiHeader.biWidth = dst_surface->width;
dst_surface->bmi->bmiHeader.biHeight = -((int)bmp_height + 200); dst_surface->bmi->bmiHeader.biHeight = -((int)dst_surface->height + 200);
dst_surface->bmi->bmiHeader.biPlanes = 1; dst_surface->bmi->bmiHeader.biPlanes = 1;
dst_surface->bmi->bmiHeader.biBitCount = dst_surface->bpp; dst_surface->bmi->bmiHeader.biBitCount = dst_surface->bpp;
dst_surface->bmi->bmiHeader.biCompression = dst_surface->bpp == 8 ? BI_RGB : BI_BITFIELDS; dst_surface->bmi->bmiHeader.biCompression = dst_surface->bpp == 8 ? BI_RGB : BI_BITFIELDS;
@ -1062,7 +1061,7 @@ HRESULT dd_CreateSurface(
} }
dst_surface->bmi->bmiHeader.biSizeImage = dst_surface->bmi->bmiHeader.biSizeImage =
((bmp_width * clr_bits + 31) & ~31) / 8 * bmp_height; ((dst_surface->width * clr_bits + 31) & ~31) / 8 * dst_surface->height;
if (dst_surface->bpp == 8) if (dst_surface->bpp == 8)
{ {
@ -1091,7 +1090,7 @@ HRESULT dd_CreateSurface(
dst_surface->bitmap = dst_surface->bitmap =
CreateDIBSection(dst_surface->hdc, dst_surface->bmi, DIB_RGB_COLORS, (void**)&dst_surface->surface, NULL, 0); CreateDIBSection(dst_surface->hdc, dst_surface->bmi, DIB_RGB_COLORS, (void**)&dst_surface->surface, NULL, 0);
dst_surface->bmi->bmiHeader.biHeight = -((int)bmp_height); dst_surface->bmi->bmiHeader.biHeight = -((int)dst_surface->height);
if (!dst_surface->bitmap) if (!dst_surface->bitmap)
{ {
@ -1099,7 +1098,7 @@ HRESULT dd_CreateSurface(
HeapAlloc( HeapAlloc(
GetProcessHeap(), GetProcessHeap(),
HEAP_ZERO_MEMORY, HEAP_ZERO_MEMORY,
dst_surface->l_pitch * (bmp_height + 200) * dst_surface->lx_pitch); dst_surface->l_pitch * (dst_surface->height + 200) * dst_surface->lx_pitch);
} }
if (dst_surface->caps & DDSCAPS_PRIMARYSURFACE) if (dst_surface->caps & DDSCAPS_PRIMARYSURFACE)

View File

@ -393,8 +393,8 @@ DWORD WINAPI d3d9_render_main(void)
lock_rc.pBits, lock_rc.pBits,
0, 0,
0, 0,
g_ddraw->primary->width, min(g_ddraw->width, g_ddraw->primary->width),
g_ddraw->primary->height, min(g_ddraw->height, g_ddraw->primary->height),
lock_rc.Pitch, lock_rc.Pitch,
g_ddraw->primary->surface, g_ddraw->primary->surface,
0, 0,