mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-24 17:49:52 +01:00
replace tabs with spaces
This commit is contained in:
parent
a8f1ff85fd
commit
2a53cb5b2f
22
render.c
22
render.c
@ -87,13 +87,13 @@ DWORD WINAPI render_main(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
|
||||||
|
|
||||||
while(ddraw->render.thread)
|
while(ddraw->render.thread)
|
||||||
{
|
{
|
||||||
scale_w = (float)ddraw->width/tex_width;
|
scale_w = (float)ddraw->width/tex_width;
|
||||||
scale_h = (float)ddraw->height/tex_height;
|
scale_h = (float)ddraw->height/tex_height;
|
||||||
|
|
||||||
if(ddraw->render.maxfps > 0)
|
if(ddraw->render.maxfps > 0)
|
||||||
{
|
{
|
||||||
tick_start = timeGetTime();
|
tick_start = timeGetTime();
|
||||||
@ -146,17 +146,17 @@ DWORD WINAPI render_main(void)
|
|||||||
glTexCoord2f(scale_w,scale_h); glVertex2f( 1, -1);
|
glTexCoord2f(scale_w,scale_h); glVertex2f( 1, -1);
|
||||||
glTexCoord2f(0,scale_h); glVertex2f(-1, -1);
|
glTexCoord2f(0,scale_h); glVertex2f(-1, -1);
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
SwapBuffers(ddraw->render.hDC);
|
SwapBuffers(ddraw->render.hDC);
|
||||||
|
|
||||||
if(ddraw->render.maxfps > 0)
|
if(ddraw->render.maxfps > 0)
|
||||||
{
|
{
|
||||||
tick_end = timeGetTime();
|
tick_end = timeGetTime();
|
||||||
|
|
||||||
if(tick_end - tick_start < frame_len)
|
if(tick_end - tick_start < frame_len)
|
||||||
{
|
{
|
||||||
Sleep( frame_len - (tick_end - tick_start));
|
Sleep( frame_len - (tick_end - tick_start));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
static unsigned char getPixel(int x, int y)
|
static unsigned char getPixel(int x, int y)
|
||||||
{
|
{
|
||||||
return ((unsigned char *)ddraw->primary->surface)[y*ddraw->primary->lPitch + x*ddraw->primary->lXPitch];
|
return ((unsigned char *)ddraw->primary->surface)[y*ddraw->primary->lPitch + x*ddraw->primary->lXPitch];
|
||||||
}
|
}
|
||||||
|
|
||||||
int* InMovie = (int*)0x00665F58;
|
int* InMovie = (int*)0x00665F58;
|
||||||
@ -34,19 +34,19 @@ BYTE* ShouldStretch = (BYTE*)0x00607D78;
|
|||||||
|
|
||||||
BOOL detect_cutscene()
|
BOOL detect_cutscene()
|
||||||
{
|
{
|
||||||
if(ddraw->width <= CUTSCENE_WIDTH || ddraw->height <= CUTSCENE_HEIGHT)
|
if(ddraw->width <= CUTSCENE_WIDTH || ddraw->height <= CUTSCENE_HEIGHT)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (ddraw->isredalert == TRUE)
|
if (ddraw->isredalert == TRUE)
|
||||||
{
|
{
|
||||||
if ((*InMovie && !*IsVQA640) || *ShouldStretch)
|
if ((*InMovie && !*IsVQA640) || *ShouldStretch)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return getPixel(CUTSCENE_WIDTH + 1, 0) == 0 || getPixel(CUTSCENE_WIDTH + 5, 1) == 0 ? TRUE : FALSE;
|
return getPixel(CUTSCENE_WIDTH + 1, 0) == 0 || getPixel(CUTSCENE_WIDTH + 5, 1) == 0 ? TRUE : FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD WINAPI render_soft_main(void)
|
DWORD WINAPI render_soft_main(void)
|
||||||
@ -101,8 +101,8 @@ DWORD WINAPI render_soft_main(void)
|
|||||||
{
|
{
|
||||||
tick_start = timeGetTime();
|
tick_start = timeGetTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
EnterCriticalSection(&ddraw->cs);
|
EnterCriticalSection(&ddraw->cs);
|
||||||
|
|
||||||
if (ddraw->primary && (ddraw->primary->palette || ddraw->bpp == 16))
|
if (ddraw->primary && (ddraw->primary->palette || ddraw->bpp == 16))
|
||||||
{
|
{
|
||||||
@ -115,36 +115,36 @@ DWORD WINAPI render_soft_main(void)
|
|||||||
{
|
{
|
||||||
StretchDIBits(ddraw->render.hDC, dst_left, dst_top, dst_width, dst_height, 0, 0, ddraw->width, ddraw->height, ddraw->primary->surface, bmi, DIB_RGB_COLORS, SRCCOPY);
|
StretchDIBits(ddraw->render.hDC, dst_left, dst_top, dst_width, dst_height, 0, 0, ddraw->width, ddraw->height, ddraw->primary->surface, bmi, DIB_RGB_COLORS, SRCCOPY);
|
||||||
}
|
}
|
||||||
else if (!(ddraw->vhack && detect_cutscene()))
|
else if (!(ddraw->vhack && detect_cutscene()))
|
||||||
{
|
{
|
||||||
SetDIBitsToDevice(ddraw->render.hDC, 0, 0, ddraw->width, ddraw->height, 0, 0, 0, ddraw->height, ddraw->primary->surface, bmi, DIB_RGB_COLORS);
|
SetDIBitsToDevice(ddraw->render.hDC, 0, 0, ddraw->width, ddraw->height, 0, 0, 0, ddraw->height, ddraw->primary->surface, bmi, DIB_RGB_COLORS);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (ddraw->vhack && ddraw->primary && detect_cutscene()) // for vhack
|
if (ddraw->vhack && ddraw->primary && detect_cutscene()) // for vhack
|
||||||
{
|
{
|
||||||
if (ddraw->primary->palette && ddraw->primary->palette->data_rgb == NULL)
|
if (ddraw->primary->palette && ddraw->primary->palette->data_rgb == NULL)
|
||||||
{
|
{
|
||||||
ddraw->primary->palette->data_rgb = &bmi->bmiColors[0];
|
ddraw->primary->palette->data_rgb = &bmi->bmiColors[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
StretchDIBits(ddraw->render.hDC, 0, 0, ddraw->render.width, ddraw->render.height, 0, ddraw->height-400, CUTSCENE_WIDTH, CUTSCENE_HEIGHT, ddraw->primary->surface, bmi, DIB_RGB_COLORS, SRCCOPY);
|
StretchDIBits(ddraw->render.hDC, 0, 0, ddraw->render.width, ddraw->render.height, 0, ddraw->height-400, CUTSCENE_WIDTH, CUTSCENE_HEIGHT, ddraw->primary->surface, bmi, DIB_RGB_COLORS, SRCCOPY);
|
||||||
|
|
||||||
if (ddraw->primary->palette && (ddraw->cursorclip.width != CUTSCENE_WIDTH || ddraw->cursorclip.height != CUTSCENE_HEIGHT))
|
if (ddraw->primary->palette && (ddraw->cursorclip.width != CUTSCENE_WIDTH || ddraw->cursorclip.height != CUTSCENE_HEIGHT))
|
||||||
{
|
{
|
||||||
ddraw->cursorclip.width = CUTSCENE_WIDTH;
|
ddraw->cursorclip.width = CUTSCENE_WIDTH;
|
||||||
ddraw->cursorclip.height = CUTSCENE_HEIGHT;
|
ddraw->cursorclip.height = CUTSCENE_HEIGHT;
|
||||||
ddraw->cursor.x = CUTSCENE_WIDTH / 2;
|
ddraw->cursor.x = CUTSCENE_WIDTH / 2;
|
||||||
ddraw->cursor.y = CUTSCENE_HEIGHT / 2;
|
ddraw->cursor.y = CUTSCENE_HEIGHT / 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(ddraw->primary && ddraw->primary->palette && (ddraw->cursorclip.width != ddraw->width || ddraw->cursorclip.height != ddraw->height))
|
else if(ddraw->primary && ddraw->primary->palette && (ddraw->cursorclip.width != ddraw->width || ddraw->cursorclip.height != ddraw->height))
|
||||||
{
|
{
|
||||||
ddraw->cursorclip.width = ddraw->width;
|
ddraw->cursorclip.width = ddraw->width;
|
||||||
ddraw->cursorclip.height = ddraw->height;
|
ddraw->cursorclip.height = ddraw->height;
|
||||||
ddraw->cursor.x = ddraw->width / 2;
|
ddraw->cursor.x = ddraw->width / 2;
|
||||||
ddraw->cursor.y = ddraw->height / 2;
|
ddraw->cursor.y = ddraw->height / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
LeaveCriticalSection(&ddraw->cs);
|
LeaveCriticalSection(&ddraw->cs);
|
||||||
|
|
||||||
@ -154,7 +154,7 @@ DWORD WINAPI render_soft_main(void)
|
|||||||
|
|
||||||
if(tick_end - tick_start < frame_len)
|
if(tick_end - tick_start < frame_len)
|
||||||
{
|
{
|
||||||
Sleep( frame_len - (tick_end - tick_start));
|
Sleep( frame_len - (tick_end - tick_start));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user