Actually make the surface regeneration work

This commit is contained in:
Clownacy 2019-09-06 22:13:00 +01:00
parent b5f2fa8693
commit 4b8a6849d3
6 changed files with 30 additions and 0 deletions

View file

@ -21,6 +21,7 @@ void Backend_DrawScreen(void);
Backend_Surface* Backend_CreateSurface(unsigned int width, unsigned int height); Backend_Surface* Backend_CreateSurface(unsigned int width, unsigned int height);
void Backend_FreeSurface(Backend_Surface *surface); void Backend_FreeSurface(Backend_Surface *surface);
BOOL Backend_IsSurfaceLost(Backend_Surface *surface); BOOL Backend_IsSurfaceLost(Backend_Surface *surface);
void Backend_RestoreSurface(Backend_Surface *surface);
unsigned char* Backend_LockSurface(Backend_Surface *surface, unsigned int *pitch); unsigned char* Backend_LockSurface(Backend_Surface *surface, unsigned int *pitch);
void Backend_UnlockSurface(Backend_Surface *surface); void Backend_UnlockSurface(Backend_Surface *surface);
void Backend_Blit(Backend_Surface *source_surface, const RECT *rect, Backend_Surface *destination_surface, long x, long y, BOOL colour_key); void Backend_Blit(Backend_Surface *source_surface, const RECT *rect, Backend_Surface *destination_surface, long x, long y, BOOL colour_key);

View file

@ -468,6 +468,11 @@ BOOL Backend_IsSurfaceLost(Backend_Surface *surface)
return FALSE; return FALSE;
} }
void Backend_RestoreSurface(Backend_Surface *surface)
{
}
unsigned char* Backend_LockSurface(Backend_Surface *surface, unsigned int *pitch) unsigned char* Backend_LockSurface(Backend_Surface *surface, unsigned int *pitch)
{ {
if (surface == NULL) if (surface == NULL)

View file

@ -98,6 +98,11 @@ BOOL Backend_IsSurfaceLost(Backend_Surface *surface)
return FALSE; return FALSE;
} }
void Backend_RestoreSurface(Backend_Surface *surface)
{
}
unsigned char* Backend_LockSurface(Backend_Surface *surface, unsigned int *pitch) unsigned char* Backend_LockSurface(Backend_Surface *surface, unsigned int *pitch)
{ {
if (surface == NULL) if (surface == NULL)

View file

@ -139,6 +139,11 @@ BOOL Backend_IsSurfaceLost(Backend_Surface *surface)
return surface->lost; return surface->lost;
} }
void Backend_RestoreSurface(Backend_Surface *surface)
{
surface->lost = FALSE;
}
unsigned char* Backend_LockSurface(Backend_Surface *surface, unsigned int *pitch) unsigned char* Backend_LockSurface(Backend_Surface *surface, unsigned int *pitch)
{ {
if (surface == NULL) if (surface == NULL)

View file

@ -105,6 +105,11 @@ BOOL Backend_IsSurfaceLost(Backend_Surface *surface)
return FALSE; return FALSE;
} }
void Backend_RestoreSurface(Backend_Surface *surface)
{
}
unsigned char* Backend_LockSurface(Backend_Surface *surface, unsigned int *pitch) unsigned char* Backend_LockSurface(Backend_Surface *surface, unsigned int *pitch)
{ {
if (surface == NULL) if (surface == NULL)

View file

@ -78,6 +78,13 @@ BOOL Flip_SystemTask(void)
Backend_DrawScreen(); Backend_DrawScreen();
if (RestoreSurfaces())
{
RestoreStripper();
RestoreMapName();
RestoreTextScript();
}
return TRUE; return TRUE;
} }
@ -551,6 +558,7 @@ int RestoreSurfaces(void) // Guessed function name - this doesn't exist in the L
if (Backend_IsSurfaceLost(framebuffer)) if (Backend_IsSurfaceLost(framebuffer))
{ {
++surfaces_regenerated; ++surfaces_regenerated;
Backend_RestoreSurface(framebuffer);
DummiedOutLogFunction(0x62); DummiedOutLogFunction(0x62);
} }
@ -561,6 +569,7 @@ int RestoreSurfaces(void) // Guessed function name - this doesn't exist in the L
if (Backend_IsSurfaceLost(surf[s])) if (Backend_IsSurfaceLost(surf[s]))
{ {
++surfaces_regenerated; ++surfaces_regenerated;
Backend_RestoreSurface(surf[s]);
DummiedOutLogFunction(0x30 + s); DummiedOutLogFunction(0x30 + s);
if (!surface_metadata[s].bSystem) if (!surface_metadata[s].bSystem)