Subject: Re: resource stripper help
There seems to be many problems.
First, why the offset is 12768 and not 12763?
EDIT: Right, version 1.56 vs 1.04. It is 12768 in 1.04 and 12763 in 1.56, so that is all right.
Why unsigned char bmpdata[BMP_DIM / 2][BMP_DIM]; ?
You make a bitmap that is not a square, probably messing the things downcode.
Like, writebmp16(filename, BMP_DIM, BMP_DIM, (unsigned char *)&bmpdata);
Does not sound right to me.
DownloadSource code (Text): infile.get(in);
infile.ignore(); // ignore the next character (this was probably originally stored as an int)
You ignore player visibility bitmask. Good, but comment makes it senseless.
You read bytes of resource distribution.
The resources block format is thus, in case you don't know it :
DownloadSource code (Text):2 bytes per cell, left to right scanlines.
Byte 1 is resource type:
if((b1>0x20)&&(b1<0x31)) fuel, b1-0x20 of it (0 thru 16)
if((b1>0x40)&&(b1<0x51)) gold
if((b1>0x80)&&(b1<0x91)) raw materials
Byte 2 is the player visibility bitmask.
bit 2 - Gray player surveyed this cell
bit 3 - Blue
bit 4 - Green
bit 5 - Red
So, your code below
DownloadSource code (Text):for(int i = 0; i < 112 && infile.tellg() <= 37854; i++){
for(int j = 0; j < 112 && infile.tellg() <= 37854; j++){
infile.get(in);
infile.ignore(); // ignore the next character (this was probably originally stored as an int)
//outfile << typetxt((unsigned char) in);
if(i % 2){ // if i is odd
bmpdata[i / 2][j] |= type((unsigned char)in); // set the low bits
}else{
bmpdata[i / 2][j] |= type((unsigned char)in) << 4; // set the high bits
}
}
//outfile << endl;
}
Makes somewhat doubtful sense.
You can use my save game reader as a reference:
http://www.rumaxclub.ru/etc/maxse_081005.zip
It takes a save file as first parameter, and outputs bitmaps and information.
No source code, unless you ask for it.
Artyom Litvinovich
This post has been edited
1
times. Last edit on Oct 05, 2008 12:38 pm by Artlav.