







WGT File Formats
Revised: June 2, 1995



The following is technical info about the formats of WGT files. You can use
this in case you need to write your own save or load procedures.



Palette files:
--------------
Palette files are the simplest of the WGT file formats.  Since the palette
contains 256 colors (numbered 0-255), and each color is made up of 3 numbers
for the red, green, and blue values, each palette files contains 768 bytes.

Each of the red, green and blue values range from 0 to 63, giving a total of
262144 possible colors!

	1 color = {
		    1 byte for red
		    1 byte for blue
		    1 byte for green
		  }
	256 colors = 3 bytes * 256 = 768 bytes



Block Files:
------------
A block file contains uncompressed image data which can be quickly loaded
into memory. The size varies depending on how large the area of the screen
you capture with the newblock command or how large the previously loaded
image was.

	Width:	1 short integer
	Height:	1 short integer
	Data:	Width*Height bytes



Map Files:
----------
Map files contain the tiled background for scrolling games. It also contains
additional information for the type of the tiles used and the positions of
the sprites which will be shown on top of the background.

1 unsigned short : contains magic number:
			8972 version 2
			8973 version 3.5
			8974 version 4.0
                        8975 version 5.0

Version 3.5 and up 
{
        1 short      : width of map (0-320)
        1 short      : height of map (0-200)
}
 or 
Version 2 
{
        1 byte       : width of map (0-200)
        1 byte       : height of map (0-200)
}

w*h bytes            : map data (bytes represent tile numbers)
                       Tile #201 is always empty in Version 3.5 or earlier.
  
256 bytes (version 4.0 and up), 200 bytes otherwise
                     : Type data (assigns a type number to each tile)

1 byte               : number of sprite structures saved in file

Sprite structure {
    1 byte			: on/off
    1 short			: x coordinate
    1 short			: y coordinate
    Version 2: 1 byte		: sprite number shown (from sprite array)
    Version 3+: 1 unsigned short: sprite number shown
  }



Sprite Files:
-------------
        1   short               : Version number (Latest is 5)
	13  bytes		: contains " Sprite File " (with spaces at ends)
	768 unsigned char	: palette info
	1   short		: Version 3.5 or less = max number of sprites per file
				 (Version 3.5 is 1000, previous are 200)
                                  Version 4+ reports number of sprites in file

        For each sprite in the file: (starting index is 0 for version 4+,
                                      1 for all others)

        sprite structure {      (starting index to max sprite)
		1 short: sprite slot status (0=empty, 1=used)
		if sprite is made (1), then read in block
		{
			2 shorts           : width and height
			width*height bytes : image data
		}
	end        

