04-23-2003, 06:11 AM
The structure of Pascal is that code blocks are enclosed in Begin...End. So the outermost Begin...End contain the entire procedure... same with the one after the while statement... that's the code inside the loop.
Sorry, I'm using untyped pointers to store the sprites. That way I can accomidate different sizes. Ignore that getmem statement. You just want to have a huge array, something like:
DIM mysprites(255, 16, 16);
That's the maximum size for a segment... but use the array with GET # statements and manually load in the individual bytes.
One other thing to consider: My sprite format is slightly different from QBs. In QB the header is three bytes... two for the width, one for the height. Mine is just two bytes. So you'll have to twiddle that a little.
Biggest problem you face is that QB doesn't have a data type for a single byte... So you have to load the bytes in pairs and then do an AND 255 to chop them down to the single byte. Example:
'untested
Sorry, I'm using untyped pointers to store the sprites. That way I can accomidate different sizes. Ignore that getmem statement. You just want to have a huge array, something like:
DIM mysprites(255, 16, 16);
That's the maximum size for a segment... but use the array with GET # statements and manually load in the individual bytes.
One other thing to consider: My sprite format is slightly different from QBs. In QB the header is three bytes... two for the width, one for the height. Mine is just two bytes. So you'll have to twiddle that a little.
Biggest problem you face is that QB doesn't have a data type for a single byte... So you have to load the bytes in pairs and then do an AND 255 to chop them down to the single byte. Example:
Code:
'Loads single bytes out of a file
OPEN "myfile.txt" FOR BINARY AS #1
temp% = 0
ctr% = 1
WHILE NOT EOF(1)
GET #1, ctr%, temp%
temp% = temp% AND 255
PRINT temp% + " ";
ctr% = ctr% + 1
WEND
PRINT "Total bytes: " + ctr%