                          ͻ
                                 WGT 4.5       
                          Quick Reference Guide
                          ͼ

ͻ
       WGT45.LIB       
ͼ
       void installkbd (void)
	 Installs a keyboard handler which permits multiple keypresses 
	 at the same time.

       void *lib2buf (char *filename)
             Loads a data file for a WGTLIB data library.

       void mdeinit (void)
             Deinitializes the mouse interrupt.

       short minit (void)
             Initializes the mouse and returns the number of buttons it has.
             Returns 0 if mouse is not found.

       void moff (void)
             Turns the mouse cursor off.

       void mon (void)
             Turns the mouse cursor on.

       void mouseshape (short x_hotspot, short y_hotspot, void far *bitmap)
             Sets the hotspot and shape of the mouse cursor.
             Bitmap is a monochrome bitmap (not created from wnewblock)

       void msetbounds (short x, short y, short x2, short y2)
             Sets the area in which the mouse can move within.

       void msetspeed (short x, short y)
             Sets the speed of the mouse horizontally and vertically.

       void msetthreshhold (short speed)
             Sets the speed at which mouse movements are doubled.

       void msetxy (short x, short y)
             Sets the coordinates of the mouse.

       void noclick (void)
             Waits until all buttons are released.

       void setlib (char *libraryname)
             Sets the WGTLIB data library name to read files from.

       void setpassword (char *newpass)
             Sets the password of the WGT Data Library.

       void uninstallkbd (void)
	 Removes the WGT custom keyboard handler.

       void vga256 (void)
             Switches to 320x200x256 mode and initializes WGT.

       char vgadetected (void)
             Returns 1 if a VGA card is found.

       block wallocblock (short width, short height)
  	 Allocates enough memory for an image of given dimensions and 
	 returns a pointer.

       void wbar (short x, short y, short x2, short y2)
             Draws a solid rectangle.

       void wbezier (tpolypoint *rawpts, short numraw, tpolypoint *curvepts,
                      short numcurve)
             Calculates a Bezier curve. (does not draw)

       void wbutt (short x, short y, short x2, short y2)
             Draws a 3D button using colors 253-255.

       void wcircle (short x, short y, short radius)
             Draws a circle with center (x,y) and radius.

       void wclip (short x, short y, short x2, short y2)
             Sets the clipping area.  

       void wcls (unsigned char col)
             Clears the entire video page with color.

       void wcolrotate (unsigned char startcolor, unsigned char finishcolor, 
                         short dir, color *palette)
             Rotates the range of colors in the direction given.
             dir=0, rotates up.
             dir=1, rotates down.

       void wcopyscreen (short x1, short y1, short x2, short y2, block source,
                          short dx, short dy, block dest)
             Copies a region of one page to the destination coordinates on
             another page.  Source and destination regions cannot overlap.

       void wdeinitpoly (void)
	 Deinitializes the WGT polygon system and frees internal buffers.

       int  wdetectcpu (void)
             Returns the type of processor.  

       void wdissolve (block sourceimage, short *pattern, short speed)
	 Dissolves a block onto the active display page, with a user-defined pattern.

       void wdonetimer (void)
 	 Removes the custom timer interrupt.

       void wdraw_scanpoly (short x, short y, wscanpoly *newp, 
                             void (*customline)(short x, short x2, short y)))
             Draws a scan-converted polygon.

       void wellipse (short x, short y, short rx, short ry)
             Draws a hollow ellipse with center (x,y) using radius (rx,ry).

       void wems_close (void)
             Deallocates EMS pages.

       void wems_copy (block sb, unsigned offset, unsigned size)
             Copies a block of memory to an offset into the page frame.

       long wems_free (void)
             Returns the number of unallocated EMS pages.

       block wems_getdata (block mydata)
             Retrieves a pointer stored in EMS into the page frame.

       void wems_getframe (int pagegroup)
             Maps 64k into the pageframe at once.

       block wems_getsprite (int spr, block *sprites)
             Gets a sprite from EMS memory, given an array of sprites.

       int  wems_init (void)
             Returns 1 if EMS was initialized properly.

       int  wems_loadsprites (color *pal, char *filename, block *sprite, 
                               int start, int end)
             Loads a sprite file into EMS.

       int  wems_map (int phys, int logi)
             Maps a logical EMS page into a physical page in the page frame.

       int  wems_open (int pages)
             Allocates a number of EMS pages (must be multiple of 4).

       int  wems_present (void)
             Returns 1 if an EMS driver is present.

       void wems_reset (void)
	 Resets the WGT EMS driver to start loading files from the 
	 beginning of EMS memory.

       block wems_storeblock (block spr)
             Stores a WGT block type into EMS.

       block wems_storedata (block spr, unsigned size)
             Stores any data pointer into EMS .

       void wfade_between (unsigned char startcolor, 
                            unsigned char finishcolor, short speed, 
                            color *pal1, color *pal2)
             Fades from one palette to another.

       void wfade_between_once (unsigned char startcolor,
                                 unsigned char finishcolor, color *pal1, 
                                 color *pal2)
             Fades from one palette to another, but only fades by
             one step, so your program can keep processing while it fades.
             It must be called at least 64 times to fade completely.

       void wfade_in (unsigned char startcolor, unsigned char finishcolor,
                       short speed, color *mypalette)
             Fades a palette in from black. It does not alter the palette
             stored in mypalette.

       void wfade_in_once (unsigned char startcolor,
                            unsigned char finishcolor, color *mypalette)
             Fades a palette in from black, performing only one step so
             your program can keep processing while it fades.
             It must be called at least 64 times to fade in completely.

       void wfade_out (unsigned char startcolor, unsigned char finishcolor, 
                        short speed, color *mypalette)
             Fades a palette out to black. It does not alter the palette
             stored in mypalette. 

       void wfade_out_once (unsigned char startcolor, 
                             unsigned char finishcolor, color *mypalette)
             Fades a palette out to black, performing only one step so
             your program can keep processing while it fades.
             It must be called at least 64 times to fade out completely.

       void wfastputpixel (short x, short y)
             Puts a single pixel on the screen. No clipping.

       void wfill_circle (short x, short y, short radius)
             Draw a filled circle with center (x,y) and radius.

       void wfill_ellipse (short x, short y, short rx, short ry)
             Draws filled ellipse with center (x,y) using radius (rx,ry).

       void wflashcursor (void)
             Flashes the simulated text cursor once.

       void wfline (short x, short y, short x2, short y2)
             Draws a fast line between (x,y) and (x2,y2). No clipping.

       void wflipblock (block flipblock, short dir)
             Flips a block in either Horizontal (0) or Vertical (1).

       void wfree_scanpoly (wscanpoly *freep)
             Frees memory used by a scan-converted polygon.

       void wfreeblock (block freeblock)
             Frees memory used by a block.

       void wfreefont (wgtfont yourfont)
             Frees memory from a previously loaded font.

       void wfreesprites (block *sprites, short start, short end)
             Frees sprites from range start-end.

       short  wget_capslock (void)
             Returns 1 if capslock is on.

       unsigned char wget_imagebit (block image)
	 Retrieves a byte of information from the end of allocated 
	 memory from an image.

       unsigned char wget_imagebyte (block image)
	 Retrieves a byte of information from the end of allocated 
	 memory from an image.

       short  wget_lalt (void)
             Returns 1 if Left Alt is depressed.

       short wget_lctrl (void)
             Returns 1 if Left Ctrl is depressed.

       short wget_lshift (void)
             Returns 1 if Left Shift is depressed.

       short wget_numlock (void)
             Returns 1 if Num Lock is on.

       short wget_ralt (void)
             Returns 1 if Right Alt is depressed

       short wget_rctrl (void)
             Returns 1 if Right Ctrl is depressed.

       short wget_rshift (void)
             Returns 1 if Right Shift is depressed.

       short wget_scrlock (void)
             Returns 1 if Scroll Lock is on.

       short wgetblockheight (block myblock)
             Returns the height of a block. (1-200)

       short wgetblockwidth (block myblock)
             Returns the width of a block. (1-320)

       short wgetmode (void)
             Returns the current video mode.

       unsigned char wgetpixel (short x, short y)
             Returns the color of a pixel at point (x,y).

       short wgettextheight (char *string, wgtfont prfont)
             Returns the height of the tallest letter in the string.

       short wgettextwidth (char *string, wgtfont prfont)
             Returns the width of the entire string.

       void wgouraudpoly (tpolypoint *vertexlist, short numvertex, short x, 
                           short y)
             Draws a Gouraud Shaded convex polygon.

       void wgtprintf (short xloc, short yloc, wgtfont prfont, char *fmt, ... )
             Allows printf commands in graphics mode.

       void whline (short x, short x2, short y)
             Draws a horizontal line.

       void whollowpoly (tpolypoint *vertexlist, short numvertex, short x, 
                          short y)
             Draws a hollow polygon.

       void winitpoly (short maxrows)
	 Initializes the WGT polygon system to a maximum number of 
	 scanlines.

       void winittimer (void)
	 Installs the custom timer interrupt.

       void wline (short x, short y, short x2, short y2)
             Draws a line between (x,y) and (x2,y2) with clipping.

       block wloadblock (char *filename)
             Loads a block from disk.

       block wloadbmp (char *filename, color *pal)
             Loads a BMP from disk.

       block wloadcel (char *filename, color *pal)
             Loads a CEL from disk.  

       wgtfont wloadfont (char *fontfile)
             Loads and allocates memory for a custom font.

       block wloadiff (char *filename, color *pal)
	 Loads an Amiga IFF/LBM format image and its associated palette.

       block wloadpak (char *filename)
             Loads a PAK image from disk and returns the pointer to it. 

       void wloadpalette (char *filename, color *mypalette)
             Loads a palette from disk. Does not set the palette.

       block wloadpcx (char *filename, color *mypal)
             Loads a PCX picture and its palette.

       void wloadsprites (color *pal, char *filename, block *sprites,
                           short start, short end)
             Loads a sprite file created with the WGT Sprite Editor.
             Returns -1 if unsuccessful or 0 if successful.

       block wnewblock (short x, short y, short x2, short y2)
             Grabs an area of the current page into a block and returns a
             pointer to the block. 

       void wnormscreen (void)
             Sets the drawing page to the VGA buffer. (visual page)

       void wouttextxy (short x, short y, wgtfont font, char *string)
             Displays a string at screen coordinates.

       void wpan (unsigned short pan_amount)
             Changes the start address of the video buffer.
             320 = one scan line down.

       void wputblock (short x, short y, block myblock, short mode)
             Puts a block onto the screen, using the specified mode.
             If mode=0, COPY mode is used.
             If mode=1, XRAY mode is used. (color 0 is not copied to page)        

       void wputblock_shade (short x, short y, block image,
	                  unsigned char *shadetable, short mode)
	 Displays a block onto the current graphics page, using a shade table.

       void wputpixel (short x, short y)
             Sets the color of the pixel at (x,y) with Clipping.

       void wreadpalette (unsigned char start, unsigned char finish, 
                           color *mypalette)
             Reads the current palette in array.

       void wrectangle (short x, short y, short x2, short y2)
             Draws a hollow rectangle.

       void wregionfill (short x, short y)
             Fills a region with the current color.

       void wremap (color *pal1, block remapblock, color *pal2)
             Remaps a block to a different palette.

       void wresize (short x1, short y1, short x2, short y2, block blockname,
                      short mode)
             Changes the size of a block on the screen, using either
             NORMAL (0) or XRAY (1) mode.

       void wresize_column (short x, short y, short y2, block image, 
				short column, short mode)
	 Resizes a single column of a bitmap to a new height on the screen.

       void wresize (short x1, short y1, short x2, short y2, block image, 
	          unsigned char *shadetable, short mode)
	 Draws a previously stored image on the screen to fit within a given 
	 boundary, using a shade table.

       void wretrace (void)
             Waits for the vertical retrace.

       short  wsaveblock (char *filename, block saveblock)
             Saves a block to disk.

       void wsavebmp (char *fname, block saveptr, color *pal)
             Saves a BMP to disk.

       short  wsavecel (char filename, block saveblock, color *pal)
             Saves a CEL to disk, using the given palette.

       short  wsavepak (char *filename, block saveblock)
             Saves a block in the PAK format. 

       void wsavepalette (char *filename, color *mypalette)
             Saves a palette to disk. 

       short wsavepcx (char *filename, block saveblock, color *mypal)
             Saves a block in the PCX format.

       short wsavesprites (color *pal, char *filename, block *image_array, 
	                short start, short end)
 	 Saves a sprite file using a palette array and a set of blocks.

       void wscan_convertpoly (tpolypoint *vertexlist, short numvertex,   
                                wscanpoly, *newp)
             Converts a list of vertices into a scan-converted polygon.

       void wset_capslock (short state)
             Sets the state of the capslock key.

	 void wset_imagebyte (block image, unsigned char status)
	 Stores a byte of information at the end of allocated memory for an image.

       void wset_numlock (short state)
             Sets the state of the numlock key.

       void wset_scrlock (short state)
             Sets the state of the scrlock key.

       void wsetcolor (unsigned char drawcolor)
             Sets the current drawing color.

       void wsetcursor (short start, short end)
             Sets the height of the text cursor.

       void wsetmode (short newmode)
             Sets the video mode.  0x03 is text mode.

       void wsetpalette (unsigned char start, unsigned char finished,
                          color *pal)
             Sets part or all of the palette.

       void wsetrgb (unsigned char color, unsigned char red,
                      unsigned char green, unsigned char blue, 
                      color *palette)
             Sets an individual color's components.

       void wsetscreen (block mypage)
             Sets the drawing page to another block.  Mypage must be a full
             screen 320x200 block.  If mypage=NULL, this is the same as
             wnormscreen.

       void wsettimerspeed (int speed)
	 Sets the custom timer interrupt to run at a different speed.

       void wskew (short x, short y, block skewblock, short degrees)
             Horizontally skews a block on the screen.

       void wsline (short x1, short y1, short x2, short y2, short *ptarray)
             Stores points on a line into an array. (used for wwarp)

       void wsolidpoly (tpolypoint *vertexlist, short numvertex, short x, 
                         short y, void (*customline)(short x, short x2, short y))
             Draws a filled convex polygon.

       void wstarttimer (void (*rout)(), int speed)
	 Installs a custom timer interrupt at the given speed.

       void wstoptimer (void)
	 Resets a custom timer interrupt to an empty procedure.

       void wstring (short x, short y, char *instring, char *legal, short num)
             Inputs a text string using the normal font.

       void wstyleline (short x, short y, short x2, short y2, unsigned short pattern)
             Draws a line using a pattern (dashed lines).

       void wtextbackground (unsigned char col)
             Sets the background text color.

       void wtextcolor (unsigned char col)
             Sets the foreground text color.

       void wtextgrid (short state)
             Turns the text grid on or off.
             State can equal:
               TEXTGRID_ON (0)
               TEXTGRID_OFF (1)

       void wtexttransparent (short mode)
             Turns text foreground or background on or off.
             Mode can equal:
               TEXTFG (0) - Foreground only
               TEXTBG (1) - Background only
               TEXTFGBG (2) - Both

       void wtexturedpoly (tpolypoint *vertexlist, short numvertex, short x, 
                            short y, block texturebitmap, short mode)
             Draws a texture-mapped convex polygon.

       void wupdate_imagebytes (block *image_array, short start, 
	 		         short end)
	 Updates status bytes for an array of images.

       void wvertres (short x1, short y1, short y2, block blockname)
             Vertically resizes a block

       void wwarp (short x1, short x2, short *top, short *bot, block blockname)
             Warps a block by using different resize rates for each
             column. No clipping is performed.

       void wwipe (short x1, short y1, short x2, short y2, block screen)
             Draws a line using colours from a hidden page.

       void wxorbox (short x, short y, short x2, short y2, unsigned char col)
             Draws a filled rectangle using XOR mode with col.

ͻ
      WGTJOY.LIB       
ͼ
       short wcalibratejoystick (joystick *joy1, joystick *joy2)
             Calibrates joysticks.

       short wcheckjoystick (void)
             Checks to see which joysticks are available.
             
       void winitjoystick (joystick *joy1, joystick *joy2)
             Initializes joysticks.

       short wreadjoystick (joystick *joy1, joystick *joy2)
             Reads joystick values into joystick structure.

ͻ
       WGT3D.LIB       
ͼ
       void winit3d (void)
             Initializes the 3D library.

       void wrotatepoints (point3d *orig_pointlist, point3d *rotated_pointlist, 
				    short maxpt)
             Rotates an array of points.

       void wsetrotation (short rx, short ry, short rz)
             Sets the rotation amount for each axis (in degrees).


ͻ
       WFILE.LIB       
ͼ
       char *wfilesel(char *mask, char *title, short x, short y,
                       block background)
             Activates the WGT file selector and returns the filename
             selected.


ͻ
      WGTSCROL.LIB     
ͼ
       short is_in_window (short currentwindow, short x, short y, short range)
             Returns 1 if the coordinate given is within the window's view

       short  soverlap (short s1, scrollsprite *wobjects1, block *sprites1,
                         short s2, scrollsprite *wobjects2, block *sprites2)
             Returns 1 if the two rectangular sprite regions overlap.

       void wcopymap (short sourcewindow, short destwindow)
	     Makes two windows share a map.

       void wendscroll (short currentwindow)
             Closes a scrolling window.

       void wfreemap (wgtmap ptr)
             Frees an allocated map file.

       unsigned short wgetworldblock (short currentwindow, short posx, short posy)
             Returns the tile number at a given location in a map.

       unsigned char wgetworldpixel (short currentwindow,  short x, short y)
             Returns the color of a pixel at the given coordinate on a map.

       void winitscroll (short currentwindow, short mode, short link, short xwidth, 
                          short ywidth, block *tileref)
             Initializes a scrolling window.

       wgtmap wloadmap (short currentwindow, char *mapfile, short *tiletypes, 
                         scrollsprite *wobjects)
             Loads a WGT map file into a scrolling window.

       void wputworldblock (short currentwindow, short posx, short posy, 
                             unsigned short tilenum)
             Changes the tile number at a location in a map.

       void wsavemap (short currentwindow, char *filename, wgtmap savemap, 
                       short *tiletypes, scrollsprite *wobjects, short numobj)
             Saves a map in the scrolling window to disk.

       void wscreen_coordx (short currentwindow, short xcoord)
	     Returns the absolute X screen coordinate of a world coordinate.

       void wscreen_coordy (short currentwindow, short xcoord)
	     Returns the absolute Y screen coordinate of a world coordinate.

       void wscrollwindow (short currentwindow, short wspeedx, short wspeedy)
             Scrolls the window by a number of pixels.

       void wshowobjects (short currentwindow, short start, short end,
                           block *sprites, scrollsprite *wobjects)
             Displays a range of sprites on a scrolling window.

       void wshowwindow (short currentwindow, short posx, short posy)
             Positions the scrolling window at a location in the map.
                   
             
ͻ
      WGTMENU.LIB      
ͼ
       short checkmenu (void)
             Loops until user clicks mouse button on menu.

       void initdropdowns (void)
             Initializes drop down menus.

       void removemenubar (void)
             Removes top menu bar.

       void showmenubar (void)
             Shows top menu bar.


ͻ
        WSPR.LIB       
ͼ
       void animate (short spritenum, char *animation_sequence)
             Sets animation for a sprite.

       void animoff (short spritenum)
             Turns off animation for a sprite.

       void animon (short spritenum)
             Turns on animation for a sprite.

       void deinitialize_sprites (void)
             Deinitializes the sprite library.

       void draw_sprites (int movement_multiplier)
             Updates the animation/movement for sprites and draws them.

       void erase_sprites (void)
             Erases the sprites from the spritescreen.

       void initialize_sprites (block *sprite_images)
             Initializes sprite movement and animation library.

       void movex (short spritenum, char *movement_sequence)
             Sets horizontal movement for a sprite.

       void movexoff (short spritenum)
             Turns off horizontal movement for a sprite.

       void movexon (short spritenum)
             Turns on horizontal movement for a sprite.

       void movey (short spritenum, char *movement_sequence)
             Sets vertical movement for a sprite.

       void moveyoff (short spritenum)
             Turns off vertical movement for a sprite.

       void moveyon (short spritenum)
             Turns on vertical movement for a sprite.

       short overlap (short spritenum_1, int spritenum_2)
             Checks for a collision between two sprites.

       void spriteoff (short spritenum)
             Turns sprite off.

       void spriteon (short spritenum, short x_coord, short y_coord, short number)
             Turns sprite on.


ͻ
      WGTFLIC.LIB      
ͼ
       short  openflic (char *filename, short mode, short update_colors)
             Opens an FLI or FLC file for animation.

       int  nextframe (void)
             Advances to the next frame of animation.

       void copyflic (void)
             Copies the virtual animation buffer to the visual screen.

       void closeflic (void)
             Closes a previously opened FLI or FLC file.




ͻ
      WGTVESA.LIB      
ͼ
       short wvesa_bank (short bank)
             Switches to a given bank of memory in the video card.

       void wvesa_bar (short x, short y, short x2, short y2)
             Draws a bar on a SVGA screen.

       void wvesa_clip (short x, short y, short x2, short y2)
             Sets clipping in SVGA modes.

       void wvesa_cls (unsigned char color)
             Clears the SVGA screen with a given color value.

       void wvesa_copyscreen (short sx, short sy, short sx2, short sy2, block src,
                               short dx, short dy, short method)
             Copies a region from a block onto a SVGA screen using either
             normal or xray copy mode.

       short wvesa_detected (void)
             Returns 1 if a VESA driver is installed.

       short wvesa_getmodeinfo (short mode)
             Stores mode specific info in VESAmode structure.

       short wvesa_getpixel (short x, short y)
             Returns the color value of a given pixel in SVGA modes.

       void wvesa_hline (short x, short x2, short y)
             Draws a horizontal line on a SVGA screen.

       short wvesa_init (short mode)
             Initializes SVGA graphics mode.            

       void wvesa_line (short x, short y, short x2, short y2)
             Draws a line on a SVGA screen.

       void wvesa_outtextxy (short x, short y, wgtfont fnt, char *printit)
             Outputs a text string to a SVGA screen.

       void wvesa_putblock (short dx, short dy, block src, short method)
             Copies a block onto a SVGA screen using normal or xray mode.

       void wvesa_putpixel (short x, short y)
             Plots a pixel on a SVGA screen.

       void wvesa_rectangle (short x, short y, short x2, short y2)
             Draws a rectangle on a SVGA screen.

       short wvesa_supported (short mode)
             Determines if the VESA driver supports a given video mode.


