				WGT File Formats			Page 1




WGT File Formats:

Revised: March 27, 1994


The follow 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.


				WGT File Formats			Page 2

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.
	Width: 1 integer
	Height: 1 integer
	Data: Width*Height bytes

Since the width and height are integers, you can have very large
blocks, even though the screen is only 320x200 pixels.


				WGT File Formats			Page 3

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 integer : contains magic number:
			 8972 version 2
			 8973 version 3.5
			 8974 version 4.0

  Version 3.5 or 4.0 {
    1 integer	     : width of map (0-320)
    1 integer        : 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)
	or
  200 bytes: 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 integer                     : x coordinate
    1 integer                     : y coordinate
    Version 2: 1 byte             : sprite number shown (from sprite array)
    Version 3: 1 unsigned integer : sprite number shown
  }


				WGT File Formats			Page 4

Sprite Files
------------

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

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

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

