mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-15 14:14:47 +01:00
don't use min macro
This commit is contained in:
parent
1564c538fd
commit
3ac47313e2
@ -36,7 +36,7 @@ void cfg_load()
|
||||
g_ddraw->accurate_timers = cfg_get_bool("accuratetimers", FALSE);
|
||||
g_ddraw->resizable = cfg_get_bool("resizable", TRUE);
|
||||
g_ddraw->nonexclusive = cfg_get_bool("nonexclusive", FALSE);
|
||||
g_ddraw->fixpitch = cfg_get_bool("fixpitch", FALSE);
|
||||
g_ddraw->fixpitch = cfg_get_bool("fixpitch", TRUE);
|
||||
g_ddraw->fixchilds = cfg_get_int("fixchilds", FIX_CHILDS_DETECT_PAINT);
|
||||
g_ddraw->fixwndprochook = cfg_get_bool("fixwndprochook", FALSE);
|
||||
g_ddraw->novidmem = cfg_get_bool("novidmem", FALSE);
|
||||
@ -332,7 +332,7 @@ static void cfg_create_ini()
|
||||
"\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"
|
||||
"fixpitch=false\n"
|
||||
"fixpitch=true\n"
|
||||
"\n"
|
||||
"; Force CPU0 affinity, avoids crashes/freezing, *might* have a performance impact\n"
|
||||
"singlecpu=true\n"
|
||||
|
@ -1030,16 +1030,17 @@ HRESULT dd_CreateSurface(
|
||||
|
||||
if (dst_surface->width && dst_surface->height)
|
||||
{
|
||||
if (dst_surface->width == 71 && dst_surface->height == 24) dst_surface->width = 72; //Commandos
|
||||
DWORD bmp_width = dst_surface->width;
|
||||
DWORD bmp_height = dst_surface->height;
|
||||
|
||||
dst_surface->lx_pitch = dst_surface->bpp / 8;
|
||||
dst_surface->l_pitch = dst_surface->width * dst_surface->lx_pitch;
|
||||
dst_surface->l_pitch = bmp_width * dst_surface->lx_pitch;
|
||||
|
||||
if (g_ddraw->fixpitch && !(dst_surface->caps & (DDSCAPS_PRIMARYSURFACE | DDSCAPS_BACKBUFFER)))
|
||||
if (g_ddraw->fixpitch)
|
||||
{
|
||||
while (dst_surface->l_pitch % 4)
|
||||
{
|
||||
dst_surface->l_pitch = ++dst_surface->width * dst_surface->lx_pitch;
|
||||
dst_surface->l_pitch = ++bmp_width * dst_surface->lx_pitch;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1047,8 +1048,8 @@ HRESULT dd_CreateSurface(
|
||||
HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * 256);
|
||||
|
||||
dst_surface->bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
dst_surface->bmi->bmiHeader.biWidth = dst_surface->width;
|
||||
dst_surface->bmi->bmiHeader.biHeight = -((int)dst_surface->height + 200);
|
||||
dst_surface->bmi->bmiHeader.biWidth = bmp_width;
|
||||
dst_surface->bmi->bmiHeader.biHeight = -((int)bmp_height + 200);
|
||||
dst_surface->bmi->bmiHeader.biPlanes = 1;
|
||||
dst_surface->bmi->bmiHeader.biBitCount = dst_surface->bpp;
|
||||
dst_surface->bmi->bmiHeader.biCompression = dst_surface->bpp == 8 ? BI_RGB : BI_BITFIELDS;
|
||||
@ -1061,7 +1062,7 @@ HRESULT dd_CreateSurface(
|
||||
}
|
||||
|
||||
dst_surface->bmi->bmiHeader.biSizeImage =
|
||||
((dst_surface->width * clr_bits + 31) & ~31) / 8 * dst_surface->height;
|
||||
((bmp_width * clr_bits + 31) & ~31) / 8 * bmp_height;
|
||||
|
||||
if (dst_surface->bpp == 8)
|
||||
{
|
||||
@ -1090,7 +1091,7 @@ HRESULT dd_CreateSurface(
|
||||
dst_surface->bitmap =
|
||||
CreateDIBSection(dst_surface->hdc, dst_surface->bmi, DIB_RGB_COLORS, (void**)&dst_surface->surface, NULL, 0);
|
||||
|
||||
dst_surface->bmi->bmiHeader.biHeight = -((int)dst_surface->height);
|
||||
dst_surface->bmi->bmiHeader.biHeight = -((int)bmp_height);
|
||||
|
||||
if (!dst_surface->bitmap)
|
||||
{
|
||||
@ -1098,7 +1099,7 @@ HRESULT dd_CreateSurface(
|
||||
HeapAlloc(
|
||||
GetProcessHeap(),
|
||||
HEAP_ZERO_MEMORY,
|
||||
dst_surface->l_pitch * (dst_surface->height + 200) * dst_surface->lx_pitch);
|
||||
dst_surface->l_pitch * (bmp_height + 200) * dst_surface->lx_pitch);
|
||||
}
|
||||
|
||||
if (dst_surface->caps & DDSCAPS_PRIMARYSURFACE)
|
||||
|
@ -393,8 +393,8 @@ DWORD WINAPI d3d9_render_main(void)
|
||||
lock_rc.pBits,
|
||||
0,
|
||||
0,
|
||||
min(g_ddraw->width, g_ddraw->primary->width),
|
||||
min(g_ddraw->height, g_ddraw->primary->height),
|
||||
g_ddraw->primary->width,
|
||||
g_ddraw->primary->height,
|
||||
lock_rc.Pitch,
|
||||
g_ddraw->primary->surface,
|
||||
0,
|
||||
|
Loading…
x
Reference in New Issue
Block a user