I'll try to get it done once again. However, I did notice the width of an image was, for example, 80 pixels, and its scanLineByteWidth was also 80, ie 1 byte per pixel for every scanline. Is the scanLineByteWidth actually incorrect for these images, ie should it actually be ceil(width/8), or is there a lot of useless data after the real useful bytes?
Edit: I can't figure out the answer to my own question, at least. Every time I get something *close* to what I want to see, but never really the real deal. This is currently, in unoptimized code, what I do:
bmpFile_->seek( 0x436 + images[ imageId ].dataPtr );
int numBits = 0;
char byte;
for( int y = 0; y < images[ imageId ].height; ++y )
{
for( int x = 0; x < images[ imageId ].width; ++x )
{
if( numBits == 0 )
{
if( bmpFile_->read( &byte, 1 ) != 1 )
{
qWarning() << "Failed to read image data: " << bmpFile_->errorString();
SDL_FreeSurface( surface );
return 0;
}
numBits = 8;
}
bool shadowSet = byte & 0x80;
byte <<= 1;
numBits--;
// if this pixel has shadow set...
if( shadowSet )
{
[...]
}
}
}
Ie, I just completely ignore image scanline and just read the bytes I need. I have also tried reading the bytes for one scanline, and start with a fresh byte the next vertical line; and I've also tried just reading scanLineByteWidth bytes and using these, and assuming the rest of the bytes are useless.
This is what I currently see. The shadows just seem to appear at the right places for the buildings, but in a weird pattern that just indicates I read too few or too many bytes. Whatever I try, the image constantly looks something like that... Any ideas?
Edit: We talked about it on IRC; I just won't support shadows atm, oh well. Next up: Try to clone some interface stuff, and add support for selecting units and showing data on them in the menu...