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

move detect_cutscene into main.c since it's used by all renderers

This commit is contained in:
FunkyFr3sh 2018-10-25 04:15:53 +02:00
parent b9eda0f6af
commit 67f7f2bfe6
3 changed files with 30 additions and 31 deletions

View File

@ -110,6 +110,36 @@ BOOL WINAPI DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
return TRUE;
}
static unsigned char getPixel(int x, int y)
{
return ((unsigned char *)ddraw->primary->surface)[y*ddraw->primary->lPitch + x*ddraw->primary->lXPitch];
}
int* InMovie = (int*)0x00665F58;
int* IsVQA640 = (int*)0x0065D7BC;
BYTE* ShouldStretch = (BYTE*)0x00607D78;
BOOL detect_cutscene()
{
if (ddraw->width <= CUTSCENE_WIDTH || ddraw->height <= CUTSCENE_HEIGHT)
return FALSE;
if (ddraw->isredalert)
{
if ((*InMovie && !*IsVQA640) || *ShouldStretch)
{
return TRUE;
}
return FALSE;
}
else if (ddraw->iscnc1)
{
return getPixel(CUTSCENE_WIDTH + 1, 0) == 0 || getPixel(CUTSCENE_WIDTH + 5, 1) == 0 ? TRUE : FALSE;
}
return FALSE;
}
HRESULT __stdcall ddraw_Compact(IDirectDrawImpl *This)
{
printf("DirectDraw::Compact(This=%p)\n", This);

View File

@ -59,7 +59,6 @@ static void DeleteContext(HGLRC context);
static BOOL TextureUploadTest();
static BOOL ShaderTest();
BOOL detect_cutscene();
DWORD WINAPI render_soft_main(void);
DWORD WINAPI render_main(void)

View File

@ -23,36 +23,6 @@
BOOL ShowDriverWarning;
static unsigned char getPixel(int x, int y)
{
return ((unsigned char *)ddraw->primary->surface)[y*ddraw->primary->lPitch + x*ddraw->primary->lXPitch];
}
int* InMovie = (int*)0x00665F58;
int* IsVQA640 = (int*)0x0065D7BC;
BYTE* ShouldStretch = (BYTE*)0x00607D78;
BOOL detect_cutscene()
{
if(ddraw->width <= CUTSCENE_WIDTH || ddraw->height <= CUTSCENE_HEIGHT)
return FALSE;
if (ddraw->isredalert)
{
if ((*InMovie && !*IsVQA640) || *ShouldStretch)
{
return TRUE;
}
return FALSE;
}
else if (ddraw->iscnc1)
{
return getPixel(CUTSCENE_WIDTH + 1, 0) == 0 || getPixel(CUTSCENE_WIDTH + 5, 1) == 0 ? TRUE : FALSE;
}
return FALSE;
}
DWORD WINAPI render_soft_main(void)
{
DWORD warningEndTick = timeGetTime() + (15 * 1000);