|
I found this bug in 1.0.14 (which is the only version I've tried so far).
From what I can see, the return value of timeGetTime() is assumed to always be positive. Since it is a DWORD value redefined as a Long in Visual BASIC, it can be negative if the uptime of the computer running the game is long enough (at least 24 days, 20 hours, 31 minutes, 23 seconds and 648 milliseconds). In various places in the code, values based on this return code are assumed never to go below zero. One thing that depends on this is a conditional test to see whether images need to be initialized, and for this reason this bug leads to graphics never being properly initialized, so most graphics isn't drawn at all (although several polygons and various text is). There may be other time-related problems as well, but since graphics are weird it's somewhat hard to tell...
Here is a quick fix to get rid of the problem (not optimal due to the extra calculations, but I believe it should work as long as you don't play for more than ~ 24 days 20 hours without quitting; after that it would depend on exactly when you started playing). I of course provide this code as is and without any warranties whatsoever. Feel free to correct any bugs I might have introduced.
First, change the "Public Declare Function" line for timeGetTime in Declares.bas to read:
Public Declare Function timeGetTimeInDll Lib "winmm.dll" Alias "timeGetTime" () As Long
Next, add the following function (dunno how to make phpBB indent so you'll have to do that on your own):
Public Function timeGetTime() As Long Static InitialTime As Long Static Running As Boolean If Not Running Then Running = True InitialTime = timeGetTimeInDll timeGetTime = 0 Exit Function End If
timeGetTime = timeGetTimeInDll
On Error GoTo needadjust timeGetTime = timeGetTime - InitialTime Exit Function
needadjust: On Error GoTo 0 Resume doadjust
doadjust: timeGetTime = CLng(CDbl(timeGetTime) - CDbl(InitialTime) + 4294967296#) End Function
|