Drawing them seemed to fix it, but I don't know if that is going to slow down the load with lots of graphics or not.
Here are the functions, plus some extra stuff:
' -----------------------------------------------------------------------------------------------------------------------------------------------------------
' These functions override the regular image loading functions so that we can display an error when an image is missing.
' -----------------------------------------------------------------------------------------------------------------------------------------------------------
Function LoadImage:TImage(Url:Object, Flags%=-1)
Local Image:TImage
Image = Brl.Max2D.LoadImage(Url, Flags)
If Image = Null Then RuntimeError("The following image failed to load: ''" + String(Url) + "''. Please reinstall the game.")
DrawImage Image, 0, 0
Return Image
End Function
Function LoadAnimImage:TImage(Url:Object, Cell_Width%, Cell_Height%, First_Cell%, Cell_Count%, Flags%=-1)
Local Image:TImage
Local Frame%
Image = Brl.Max2D.LoadAnimImage(Url, Cell_Width, Cell_Height, First_Cell, Cell_Count, Flags)
If Image = Null Then RuntimeError("The following image failed to load: ''" + String(Url) + "''. Please reinstall the game.")
For Frame = First_Cell To First_Cell+(Cell_Count-1)
DrawImage Image, 0, 0, Frame
Next
Return Image
End Function
' -----------------------------------------------------------------------------------------------------------------------------------------------------------
' This function overrides the standard RuntimeError function which does not work properly. Assert also does not work.
' -----------------------------------------------------------------------------------------------------------------------------------------------------------
Function RuntimeError(Error$)
EndGraphics
Notify(Error$, True)
End
End Function
' -----------------------------------------------------------------------------------------------------------------------------------------------------------
' This function oveerides the standard Flip() function with a lag fix for DirectX.
' -----------------------------------------------------------------------------------------------------------------------------------------------------------
Function Flip(Sync%=-1)
Brl.Graphics.Flip Sync
?Win32
If TD3D7Max2DDriver(_max2dDriver)
Local sdesc:DDSurfaceDesc2 = New DDSurfaceDesc2
sdesc.dwSize = SizeOf(sdesc)
Local res:Int = PrimaryDevice.backbuffer.Lock(Null,sdesc,DDLOCK_WAIT|DDLOCK_READONLY,Null)
PrimaryDevice.backbuffer.unlock(Null)
EndIf
?
End Function