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

remove bool and make guard lines adjustable

This commit is contained in:
FunkyFr3sh 2022-09-29 21:52:07 +02:00
parent 94ae5cf31f
commit 5c0dc2753d
3 changed files with 6 additions and 7 deletions

View File

@ -152,7 +152,7 @@ typedef struct CNCDDRAW
BOOL d3d9linear;
BOOL gdilinear;
BOOL d3d9on12;
BOOL no_guard_lines;
int guard_lines;
int resolutions;
BOOL armadahack;
BOOL tshack;

View File

@ -51,7 +51,7 @@ void cfg_load()
g_ddraw->fpupreserve = cfg_get_bool("fpupreserve", FALSE);
g_ddraw->allow_wmactivate = cfg_get_bool("allow_wmactivate", FALSE);
g_ddraw->d3d9_adapter = cfg_get_int("d3d9_adapter", 0);
g_ddraw->no_guard_lines = cfg_get_bool("no_guard_lines", FALSE);
g_ddraw->guard_lines = cfg_get_int("guard_lines", 200);
g_ddraw->opengl_core = cfg_get_bool("opengl_core", FALSE);
cfg_get_string("screenshotdir", ".\\Screenshots\\", g_ddraw->screenshot_dir, sizeof(g_ddraw->screenshot_dir));
@ -356,7 +356,7 @@ static void cfg_create_ini()
"d3d9_adapter=0\n"
"opengl_core=false\n"
"d3d9on12=false\n"
"no_guard_lines=false\n"
"guard_lines=200\n"
"game_handles_close=false\n"
"accuratetimers=false\n"
"fixpitch=true\n"
@ -739,7 +739,7 @@ static void cfg_create_ini()
"\n"
"; Fairy Tale About Father Frost, Ivan and Nastya\n"
"[mrazik]\n"
"no_guard_lines=true\n"
"guard_lines=0\n"
"\n"
"; Future Cop - L.A.P.D.\n"
"[FCopLAPD]\n"

View File

@ -1305,16 +1305,15 @@ HRESULT dd_CreateSurface(
dst_surface->l_pitch = ((dst_surface->width * dst_surface->bpp + 31) & ~31) >> 3;
dst_surface->size = dst_surface->l_pitch * dst_surface->height;
int guard_lines = g_ddraw->no_guard_lines ? 0 : 200;
DWORD aligned_width = dst_surface->l_pitch / dst_surface->lx_pitch;
DWORD bmi_size = sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * 256;
DWORD bmp_size = dst_surface->l_pitch * (dst_surface->height + guard_lines);
DWORD bmp_size = dst_surface->l_pitch * (dst_surface->height + g_ddraw->guard_lines);
dst_surface->bmi = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, bmi_size);
dst_surface->bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
dst_surface->bmi->bmiHeader.biWidth = aligned_width;
dst_surface->bmi->bmiHeader.biHeight = -((int)dst_surface->height + guard_lines);
dst_surface->bmi->bmiHeader.biHeight = -((int)dst_surface->height + g_ddraw->guard_lines);
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;