Author |
Message |
NewGuy Guest
Offline
|
Posted: Sat Jun 26, 2004 12:06 am Post subject: LVL file format |
 |
|
|
|
Can someone point to me to a document which explains the LVL file format, or teach me here? |
|
Back to top |
|
 |
SuSE Me measures good

Joined: Dec 02 2002 Posts: 2307 Offline
|
|
Back to top |
|
 |
2dragons Novice
Joined: Feb 17 2004 Posts: 95 Offline
|
Posted: Sat Jun 26, 2004 1:35 am Post subject: |
 |
|
|
|
If bitmap for tileset is included expect:
/*
* [File Header]
* offset length info
*-------------------------------------------
* 0 2 Type of file "BM"
* 2 4 Total file size
* 6 2 Reserved
* 8 2 Reserved
* 10 4 Bitmap offset
*
* [Info Header]
* offset length info
*-------------------------------------------
* 14 4 Bitmap info size
* 18 4 Width
* 22 4 Height
* 26 2 Bitplane size
* 28 2 Bit count
* 30 4 Compression type
* 34 4 Image size
* 38 4 Pixels per meter
* 42 4 Pixels per meter
* 46 4 Colors used
* 50 4 Colors important
*
* [Color Table] for( i = 0; i < 256; i++ )
* 54*i+0 1 Red
* 54*i+1 1 Green
* 54*i+2 1 Blue
* 54*i+3 1 Not used
*
* Notes:
* Type == BM
* Compression == 0
* Width == 304
* Height == 160
* Bits == 8
*
*/
After that just follow from the other guys link or here's the code I used:
while( available(4) ) {
byte[] b = readIn( 4 );
ByteArray array = new ByteArray( b );
int i = array.readLittleEndianInt( 0 );
int tile = i >> 24 & 0x00ff;
int y = (i >> 12) & 0x03FF;
int x = i & 0x03FF;
m_level[x][y] = tile;
}
Should be enough for you to figure it out |
|
Back to top |
|
 |
NewGuy Guest
Offline
|
Posted: Sat Jun 26, 2004 1:55 pm Post subject: |
 |
|
|
|
Yeah, seems pretty easy. I'm just not good with windows bmp files, so I'll have to look over that.
Oh, and the color table. Not too sure what to do there. |
|
Back to top |
|
 |
|