The Build Engine
|
Main engine include file. More...
Go to the source code of this file.
Macros | |
#define | SUPERBUILD /* don't touch this. */ |
Functions | |
void | faketimerhandler (void) |
int | initmouse (void) |
int | setgamemode (char davidoption, long daxdim, long daydim) |
Set the video mode. More... | |
int | getceilzofslope (short sectnum, long dax, long day) |
Get the ceiling z value for a point in a sector. More... | |
int | getflorzofslope (short sectnum, long dax, long day) |
Get the floor z value for a point in a sector. More... | |
void | getzsofslope (short sectnum, long dax, long day, long *ceilz, long *florz) |
Get the floor and ceiling z values for a point. More... | |
void | setaspect (long daxrange, long daaspect) |
Set aspect ratio and viewing range angle. More... | |
int | insertsprite (short sectnum, short statnum) |
Insert a sprite into a sector. More... | |
void | updatesector (long x, long y, short *sectnum) |
Update a sector pointer, given x and y values. More... | |
int | lastwall (short point) |
Find the wall to the left of another wall. More... | |
void | initspritelists (void) |
Set up the sprite lists. More... | |
int | deletesprite (short spritenum) |
Delete a sprite from the map. More... | |
int | insertspritesect (short sectnum) |
int | deletespritesect (short deleteme) |
int | deletespritestat (short deleteme) |
int | insertspritestat (short statnum) |
int | changespritesect (short spritenum, short newsectnum) |
int | changespritestat (short spritenum, short newstatnum) |
void | loadtile (short tilenume) |
Loads a tile into memory. More... | |
void | setmmxoverlay (int isenabled) |
int | getmmxoverlay (void) |
void | nextpage (void) |
Flip to next drawing page. More... | |
void | drawrooms (long daposx, long daposy, long daposz, short daang, long dahoriz, short dacursectnum) |
Draw the 3D screen to the current drawing page. More... | |
int | loadboard (char *filename, long *daposx, long *daposy, long *daposz, short *daang, short *dacursectnum) |
Loads a map from disk. More... | |
void | drawmasks (void) |
Draw the sprites and maskwalls to the current drawing page. More... | |
void | printext256 (long xpos, long ypos, short col, short backcol, char name[82], char fontsize) |
Draws a text message to the screen. More... | |
void | printext256_noupdate (long xpos, long ypos, short col, short backcol, char name[82], char fontsize) |
Draws a text message to the screen without refreshing. More... | |
void | initengine (void) |
Initialize the Build Engine. More... | |
void | uninitengine (void) |
Uninitialize the Build Engine. More... | |
int | loadpics (char *filename) |
Loads an artwork file into the engine. More... | |
int | saveboard (char *filename, long *daposx, long *daposy, long *daposz, short *daang, short *dacursectnum) |
Saves a map to disk. More... | |
void | plotpixel (long x, long y, char col) |
Plots a pixel to the screen. More... | |
unsigned char | getpixel (long x, long y) |
Returns the color of a pixel on screen. More... | |
void | setbrightness (char dabrightness, unsigned char *dapal) |
Adjust the gamma of a VGA palette. More... | |
int | screencapture (char *filename, char inverseit) |
Take a screenshot. More... | |
void | getmousevalues (short *mousx, short *mousy, short *bstatus) |
Get the current mouse location and button state. More... | |
int | clipmove (long *x, long *y, long *z, short *sectnum, long xvect, long yvect, long walldist, long ceildist, long flordist, unsigned long cliptype) |
Move an object using collision detection. More... | |
void | getzrange (long x, long y, long z, short sectnum, long *ceilz, long *ceilhit, long *florz, long *florhit, long walldist, unsigned long cliptype) |
Find the highest and lowest z coordinates your clipping box can get to. More... | |
int | getangle (long xvect, long yvect) |
Gets the angle of a vector. More... | |
void | alignceilslope (short dasect, long x, long y, long z) |
Adjust the slope of a sector's ceiling to pass through a point. More... | |
void | alignflorslope (short dasect, long x, long y, long z) |
Adjust the slope of a sector's floor to pass through a point. More... | |
int | hitscan (long xs, long ys, long zs, short sectnum, long vx, long vy, long vz, short *hitsect, short *hitwall, short *hitsprite, long *hitx, long *hity, long *hitz, unsigned long cliptype) |
Project a ray and report what it hit. More... | |
int | inside (long x, long y, short sectnum) |
Tests to see if a 2d point is in a sector. More... | |
void | setfirstwall (short sectnum, short newfirstwall) |
Sets the first wall of a sector. More... | |
void | rotatepoint (long xpivot, long ypivot, long x, long y, short daang, long *x2, long *y2) |
Rotate / translate a point. More... | |
int | drawtilescreen (long pictopleft, long picbox) |
Draw the tile screen. More... | |
void | clearview (long dacol) |
Clear the current video page to a given color. More... | |
void | clearallviews (long dacol) |
Clear all video pages to a given color. More... | |
void | draw2dgrid (long posxe, long posye, short ange, long zoome, short gride) |
Draw a 2D grid. More... | |
void | draw2dscreen (long posxe, long posye, short ange, long zoome, short gride) |
Draw the 2D screen. More... | |
int | sectorofwall (short theline) |
A fast routine to find the sector that owns a certain wall. More... | |
int | setsprite (short spritenum, long newx, long newy, long newz) |
Puts a sprite somewhere, without checking for validity. More... | |
void | dragpoint (short pointhighlight, long dax, long day) |
Drag a wall to a new point. More... | |
int | ksqrt (long num) |
Integer Square Root Function. More... | |
int | loopnumofsector (short sectnum, short wallnum) |
Find number of walls in sector, up to a known wall. More... | |
int | cansee (long x1, long y1, long z1, short sect1, long x2, long y2, long z2, short sect2) |
Check if two points can see each other. More... | |
int | lintersect (long x1, long y1, long z1, long x2, long y2, long z2, long x3, long y3, long x4, long y4, long *intx, long *inty, long *intz) |
int | rintersect (long x1, long y1, long z1, long vx, long vy, long vz, long x3, long y3, long x4, long y4, long *intx, long *inty, long *intz) |
int | allocatepermanenttile (short tilenume, long xsiz, long ysiz) |
Allocate a tile permanently. More... | |
void | drawline256 (long x1, long y1, long x2, long y2, unsigned char col) |
Draw a line. More... | |
void | copytilepiece (long tilenume1, long sx1, long sy1, long xsiz, long ysiz, long tilenume2, long sx2, long sy2) |
Copy a piece of a tile to another tile, skipping transparent pixels. More... | |
int | nextsectorneighborz (short sectnum, long thez, short topbottom, short direction) |
Find the next closest ceiling or floor in surrounding sectors. More... | |
int | neartag (long xs, long ys, long zs, short sectnum, short ange, short *neartagsector, short *neartagwall, short *neartagsprite, long *neartaghitdist, long neartagrange, char tagsearch) |
Find the closest objects with tags the player is pointing at. More... | |
int | pushmove (long *x, long *y, long *z, short *sectnum, long walldist, long ceildist, long flordist, unsigned long cliptype) |
Try to keep object away from wall. More... | |
int | krand (void) |
Returns a random number. More... | |
void | flushperms (void) |
void | rotatesprite (long sx, long sy, long z, short a, short picnum, signed char dashade, char dapalnum, char dastat, long cx1, long cy1, long cx2, long cy2) |
Rotate and draw a sprite on the screen. More... | |
void | makepalookup (long palnum, char *remapbuf, signed char r, signed char g, signed char b, char dastat) |
Make a lookup table for remapping. More... | |
void | drawmapview (long dax, long day, long zoome, short ang) |
Draw the overhead textured map view. More... | |
void | setview (long x1, long y1, long x2, long y2) |
Sets the viewing window for 3D mode. More... | |
void | setviewtotile (short tilenume, long xsiz, long ysiz) |
Shows a tile on screen, saving the previous view. More... | |
void | setviewback (void) |
Shows the screen as it was previous to the last setviewtotile. More... | |
void | squarerotatetile (short tilenume) |
Rotates a tile's image. More... | |
void | preparemirror (long dax, long day, long daz, short daang, long dahoriz, short dawall, short dasector, long *tposx, long *tposy, short *tang) |
void | completemirror (void) |
int | clipinsidebox (long x, long y, short wallnum, long walldist) |
Check if a clipping box intersects a wall. More... | |
void | qloadkvx (long voxindex, char *filename) |
Load a voxel. More... | |
Main engine include file.
A list of all symbols exported from engine.c for a game's use.
void alignceilslope | ( | short | dasect, |
long | x, | ||
long | y, | ||
long | z | ||
) |
Adjust the slope of a sector's ceiling to pass through a point.
This function will cause the slope of a sector to change and the sector plane to pass through the point specified.
dasect | The sector to modify. |
x | The X coordinate to intersect. |
y | The Y coordinate to intersect. |
z | The Z coordinate to intersect. |
void alignflorslope | ( | short | dasect, |
long | x, | ||
long | y, | ||
long | z | ||
) |
Adjust the slope of a sector's floor to pass through a point.
This function will cause the slope of a sector to change and the sector plane to pass through the point specified.
dasect | The sector to modify. |
x | The X coordinate to intersect. |
y | The Y coordinate to intersect. |
z | The Z coordinate to intersect. |
int allocatepermanenttile | ( | short | tilenume, |
long | xsiz, | ||
long | ysiz | ||
) |
Allocate a tile permanently.
This function allocates a place on the cache as permanent.
tilenume | The tile number to associate with the memory. |
xsiz | The width to allocate. |
ysiz | The height to allocate. |
int cansee | ( | long | x1, |
long | y1, | ||
long | z1, | ||
short | sect1, | ||
long | x2, | ||
long | y2, | ||
long | z2, | ||
short | sect2 | ||
) |
Check if two points can see each other.
This function will determine whether there is a line of sight between two points.
x1 | X coordinate of point 1. |
y1 | Y coordinate of point 1. |
z1 | Z coordinate of point 1. |
sect1 | Point 1's sector. |
x2 | X coordinate of point 2. |
y2 | Y coordinate of point 2. |
z2 | Z coordinate of point 2. |
sect2 | Point 2's sector. |
void clearallviews | ( | long | dacol | ) |
Clear all video pages to a given color.
This function clears all the video pages to the color dacol.
dacol | The color to clear to. |
void clearview | ( | long | dacol | ) |
Clear the current video page to a given color.
This function clears the current video page to the color dacol.
dacol | The color to clear to. |
int clipinsidebox | ( | long | x, |
long | y, | ||
short | wallnum, | ||
long | walldist | ||
) |
Check if a clipping box intersects a wall.
This function will test if a box intersects a wall.
It returns TRUE if an intersection ocurrs.
x | Center of box X. |
y | Center of box Y. |
wallnum | Wall to test against. |
walldist | Radius of clipping box. |
int clipmove | ( | long * | x, |
long * | y, | ||
long * | z, | ||
short * | sectnum, | ||
long | xvect, | ||
long | yvect, | ||
long | walldist, | ||
long | ceildist, | ||
long | flordist, | ||
unsigned long | cliptype | ||
) |
Move an object using collision detection.
This function will move any object at any velocity and make sure the object stays a certain distance from walls.
*x | A pointer to the object's X coordinate. |
*y | A pointer to the object's Y coordinate. |
*z | A pointer to the object's Z coordinate. |
*sectnum | A pointer to the object's current sector. |
xvect | The desired X velocity of movement. |
yvect | The desired Y velocity of movement. |
walldist | The distance the object should stay away from walls. |
ceildist | The distance the object should stay away from the ceiling. |
flordist | The distance the object should stay away from the floor. |
cliptype | See description below. |
void copytilepiece | ( | long | tilenume1, |
long | sx1, | ||
long | sy1, | ||
long | xsiz, | ||
long | ysiz, | ||
long | tilenume2, | ||
long | sx2, | ||
long | sy2 | ||
) |
Copy a piece of a tile to another tile, skipping transparent pixels.
This function will copy a piece of tilenume1 into tilenume2, skipping transparent parts. If the source coordinates are larger than the source tile, the texture will automatically wrap around.
NOTE: IF THE MODIFIED TILE GETS REMOVED FROM THE CACHE, tilenume2 WILL BE RESET TO ITS ORIGINAL FORM.
IF YOU NEED TO KEEP THE TILE CREATED BY THIS FUNCTION, CALL allocatepermanenttile ON IT FIRST!
tilenume1 | The source tile |
sx1 | X coordinate to start the copy from |
sy1 | Y coordinate to start the copy from. |
xsiz | The width to copy from the source. |
ysiz | The height to copy from the source. |
tilenume2 | The destination tile. |
sx2 | The X coordinate to paste at. |
sy2 | The Y coordinate to paste at. |
int deletesprite | ( | short | spritenum | ) |
Delete a sprite from the map.
This function will delete a sprite.
spritenum | The sprite number to delete. |
void dragpoint | ( | short | pointhighlight, |
long | dax, | ||
long | day | ||
) |
Drag a wall to a new point.
This function will reliabaly drag a point to a new location on the map, using a method identical to dragging the point in 2D edit mode.
pointhighlight | The wall to drag. |
dax | The X coordinate to drag to. |
day | The Y coordinate to drag to. |
void draw2dgrid | ( | long | posxe, |
long | posye, | ||
short | ange, | ||
long | zoome, | ||
short | gride | ||
) |
Draw a 2D grid.
This function is used by Build to draw the grid in 2D.
NOTE: This function works only in two graphics modes:
640*350*16col, 640*480*16col.
posxe | Left side of visible grid. |
posye | Top side of visible grid. |
ange | Not used. |
zoome | Zoom factor of grid. |
gride | The grid's scale. |
void draw2dscreen | ( | long | posxe, |
long | posye, | ||
short | ange, | ||
long | zoome, | ||
short | gride | ||
) |
Draw the 2D screen.
Thus function is used by build to draw the 2d screen.
See draw2dgrid for explanation.
void drawline256 | ( | long | x1, |
long | y1, | ||
long | x2, | ||
long | y2, | ||
unsigned char | col | ||
) |
Draw a line.
This function draws a colored, solid line.
x1 | X coordinate of starting point. |
y1 | Y coordinate of starting point. |
x2 | X coordinate of ending point. |
y2 | Y coordinate of ending point. |
col | Color to use. |
void drawmapview | ( | long | dax, |
long | day, | ||
long | zoome, | ||
short | ang | ||
) |
Draw the overhead textured map view.
This function is used to draw the overhead textured map view.
dax | The x coordinate to center on the map. |
day | The y coordinate to center on the map. |
zoome | The zoom to apply to the map. |
ang | The angle to rotate the map by. |
void drawmasks | ( | void | ) |
Draw the sprites and maskwalls to the current drawing page.
This function will draw the visible sprites and masked walls to the current drawing page.
void drawrooms | ( | long | daposx, |
long | daposy, | ||
long | daposz, | ||
short | daang, | ||
long | dahoriz, | ||
short | dacursectnum | ||
) |
Draw the 3D screen to the current drawing page.
This function draws the current 3D screen to the current drawing page. Remember to call nextpage() to actually show the page on the screen!
daposx | X position of the camera. |
daposy | Y position of the camera. |
daposz | Z position of the camera. |
daang | Viewing angle of the camera. |
dahoriz | ??? fixme |
dacursectnum | Sector camera is currently in. |
int drawtilescreen | ( | long | pictopleft, |
long | picbox | ||
) |
Draw the tile screen.
This function draws the tile chooser in Build. (what you get when you press "v".)
pictopleft | The first tile to show. |
picbox | The tile to highlight. |
int getangle | ( | long | xvect, |
long | yvect | ||
) |
Gets the angle of a vector.
This function will return the angle closest to the vector you specify.
There are 2048 possible angles, starting from the right (3 o'clock), going clockwise.
xvect | The x component. |
yvect | The y component. |
int getceilzofslope | ( | short | sectnum, |
long | dax, | ||
long | day | ||
) |
Get the ceiling z value for a point in a sector.
This function returns the Z value of a ceiling at a point in the sector.
sectnum | The sector to look in. |
dax | The x coordinate to look in. |
day | The y coordinate to look in. |
int getflorzofslope | ( | short | sectnum, |
long | dax, | ||
long | day | ||
) |
Get the floor z value for a point in a sector.
This function returns the Z value of a floor at a point in the sector.
sectnum | The sector to look in. |
dax | The x coordinate to look in. |
day | The y coordinate to look in. |
void getmousevalues | ( | short * | mousx, |
short * | mousy, | ||
short * | bstatus | ||
) |
Get the current mouse location and button state.
This function will store the current mouse position and the state of the mouse buttons in the pointers you give it.
mousx | A pointer to write the X position of the mouse to. |
mousy | A pointer to write the Y position of the mouse to. |
bstatus | A pointer to write the current state of the mouse buttons to. |
unsigned char getpixel | ( | long | x, |
long | y | ||
) |
Returns the color of a pixel on screen.
This function will find the color of a pixel in any graphics mode.
NOTE: This function is not designed to be fast! – Use it in moderation.
x | The x cordinate of the pixel. |
y | The y coordinate of the pixel. |
void getzrange | ( | long | x, |
long | y, | ||
long | z, | ||
short | sectnum, | ||
long * | ceilz, | ||
long * | ceilhit, | ||
long * | florz, | ||
long * | florhit, | ||
long | walldist, | ||
unsigned long | cliptype | ||
) |
Find the highest and lowest z coordinates your clipping box can get to.
This function finds the highest and lowest z coordinates your clipping box can get to.
x | X coordinate of location. |
y | Y coordinate of location. |
z | Z coordinate of location. |
sectnum | Current sector. |
*ceilz | Pointer to store Z extent of ceiling. |
*florz | Pointer to store Z extent of floor. |
*ceilhit | First object hit in the up direction. |
*florhit | First object hit in the down direction. |
walldist | Size of your clipping box. |
cliptype | See description below. |
void getzsofslope | ( | short | sectnum, |
long | dax, | ||
long | day, | ||
long * | ceilz, | ||
long * | florz | ||
) |
Get the floor and ceiling z values for a point.
This function finds the Z value of a floor and ceiling, and stores the values in two pointers.
sectnum | The sector to look in. |
dax | The x coordinate to look in. |
day | The y coordinate to look in. |
*ceilz | A pointer to write the ceiling z value to. |
*florz | A pointer to write the floor z value to. |
int hitscan | ( | long | xs, |
long | ys, | ||
long | zs, | ||
short | sectnum, | ||
long | vx, | ||
long | vy, | ||
long | vz, | ||
short * | hitsect, | ||
short * | hitwall, | ||
short * | hitsprite, | ||
long * | hitx, | ||
long * | hity, | ||
long * | hitz, | ||
unsigned long | cliptype | ||
) |
Project a ray and report what it hit.
This function will project a ray in the direction specified by a 3D vector and report where and what the ray hit.
xs | Starting X position. |
ys | Starting Y position. |
zs | Starting Z position. |
sectnum | Starting sector. |
vx | X component of 3D vector. |
vy | Y component of 3D vector. |
vz | Z component of 3D vector. |
*hitsect | The sector that the intersection occured in. |
*hitwall | The wall that got hit. |
*hitsprite | The sprite that got hit. |
*hitx | The X coordinate of the point that the intersection occured. |
*hity | The Y coordinate of the point that the intersection occured. |
*hitz | The Z coordinate of the point that the intersection occured. |
cliptype | See description below. |
void initengine | ( | void | ) |
Initialize the Build Engine.
This function initializes many variables for the Build Engine. You should call this function before using any other Build functions.
void initspritelists | ( | void | ) |
Set up the sprite lists.
This function will initialize the doubly-linked sprite sector and sprite status lists.
int insertsprite | ( | short | sectnum, |
short | statnum | ||
) |
Insert a sprite into a sector.
This function is used to insert a sprite into a sector.
sectnum | The sector number to place the sprite into. |
statnum | The sprite's status. (cstat) |
int inside | ( | long | x, |
long | y, | ||
short | sectnum | ||
) |
Tests to see if a 2d point is in a sector.
This function will check if a 2d point is inside a sector.
x | X coordinate of point. |
y | Y coordinate of point. |
sectnum | The sector to test against. |
int krand | ( | void | ) |
Returns a random number.
This function returns a pseudorandom number in the range 0-65535.
int ksqrt | ( | long | num | ) |
Integer Square Root Function.
This function will return an integer approximating the square root of a number.
num | The number to work on. |
int lastwall | ( | short | point | ) |
Find the wall to the left of another wall.
Use this function as a reverse function of wall[].point2.
point | The wall to search with. |
int loadboard | ( | char * | filename, |
long * | daposx, | ||
long * | daposy, | ||
long * | daposz, | ||
short * | daang, | ||
short * | dacursectnum | ||
) |
Loads a map from disk.
This function loads a map from disk and stores the starting location in the pointers you pass. If no extention is given to filename, .MAP is assumed.
filename | The filename to load. |
*daposx | A pointer for the starting X coordinate. |
*daposy | A pointer for the starting Y coordinate. |
*daposz | A pointer for the starting Z coordinate. |
*daang | A pointer for the starting angle. |
*dacursectnum | A pointer for the starting sector. |
int loadpics | ( | char * | filename | ) |
Loads an artwork file into the engine.
This function is used to load an artwork file into memory so the engine knows where to find the tiles referenced by the artwork file. If no extention is given to filename, .ART is assumed.
*filename | The name of the artwork file. |
void loadtile | ( | short | tilenume | ) |
Loads a tile into memory.
This function will ensure tilenume is in memory.
tilenume | The tile to load. |
int loopnumofsector | ( | short | sectnum, |
short | wallnum | ||
) |
Find number of walls in sector, up to a known wall.
This function will find the number of walls in a sector, up to the specified wall.
sectnum | The sector to work on. |
wallnum | The wall to stop on. |
void makepalookup | ( | long | palnum, |
char * | remapbuf, | ||
signed char | r, | ||
signed char | g, | ||
signed char | b, | ||
char | dastat | ||
) |
Make a lookup table for remapping.
Ken's description of this function: This function allows different shirt colors for sprites. First prepare remapbuf, which is a 256 byte buffer of chars with the colors to remap.
Palnum can be anywhere from 1-15.
Since 0 is where the normal palette is stored, it is a bad idea to call this function with palnum=0.
In BUILD.H notice I added a new variable, spritepal[MAXSPRITES].
Usually the value of this is 0 for the default palette.
But if you change it to the palnum in the code between drawrooms() and drawmasks then the sprite will be drawn with that remapped palette.
The last 3 parameters are the color that the palette fades to as you get further away.
This color is normally black (0,0,0).
White would be (63,63,63).
if ((dastat&1) == 0) then makepalookup will allocate & deallocate the memory block for use but will not waste the time creating a palookup table (it assumes you will create one yourself).
int neartag | ( | long | xs, |
long | ys, | ||
long | zs, | ||
short | sectnum, | ||
short | ange, | ||
short * | neartagsector, | ||
short * | neartagwall, | ||
short * | neartagsprite, | ||
long * | neartaghitdist, | ||
long | neartagrange, | ||
char | tagsearch | ||
) |
Find the closest objects with tags the player is pointing at.
This function will get the nearest tagged objects. It is useful for door and switch activation code, among other things.
xs | X coordinate to search from. |
ys | Y coordinate to search from. |
zs | Z coordinate to search from. |
sectnum | Sector number to search from. |
ange | Angle to search from. |
*neartagsector | The nearest tagged sector. |
*neartagwall | The nearest tagged wall. |
*neartagsprite | The nearest tagged sprite. |
*neartaghitdist | Distance to the found object. |
neartagrange | Maximum distance to search. |
tagsearch | What to search for. |
void nextpage | ( | void | ) |
Flip to next drawing page.
This function flips to the next drawing page. After a page is prepared, use this function to show the it on the screen and set up the next one for drawing.
int nextsectorneighborz | ( | short | sectnum, |
long | thez, | ||
short | topbottom, | ||
short | direction | ||
) |
Find the next closest ceiling or floor in surrounding sectors.
This function will find the next closest ceiling or floor in the sectors surrounding the given sector. It is useful for calculating where elevators should stop.
sectnum | The sector to test with |
thez | The z coordinate to start the search from. |
topbottom | Search ceilings/floors only. |
direction | Search up/down. |
void plotpixel | ( | long | x, |
long | y, | ||
char | col | ||
) |
Plots a pixel to the screen.
This function can plot a pixel to the screen in any graphics mode.
NOTE: This function is not designed to be fast! Use it in moderation.
x | The x coordinate of the pixel. |
y | The y coordinate of the pixel. |
col | The color of the pixel. |
void printext256 | ( | long | xpos, |
long | ypos, | ||
short | col, | ||
short | backcol, | ||
char | name[82], | ||
char | fontsize | ||
) |
Draws a text message to the screen.
This function will draw a message to the screen using one of the built in fonts.
xpos | X position of text. |
ypos | Y position of text. |
col | Color of text. |
backcol | Background color of text, or -1 for transparency. |
name | The text to draw. |
fontsize | The font size. Legal values: 0 – 8x8 font. 1 – 4x6 font. |
void printext256_noupdate | ( | long | xpos, |
long | ypos, | ||
short | col, | ||
short | backcol, | ||
char | name[82], | ||
char | fontsize | ||
) |
Draws a text message to the screen without refreshing.
This function will draw a message to the screen using one of the built in fonts. It will also avoid refreshing the screen. See Ryan's notes below.
xpos | X position of text. |
ypos | Y position of text. |
col | Color of text. |
backcol | Background color of text, or -1 for transparency. |
name | The text to draw. |
fontsize | The font size. Legal values: 0 – 8x8 font. 1 – 4x6 font. |
int pushmove | ( | long * | x, |
long * | y, | ||
long * | z, | ||
short * | sectnum, | ||
long | walldist, | ||
long | ceildist, | ||
long | flordist, | ||
unsigned long | cliptype | ||
) |
Try to keep object away from wall.
This function checks if an object is too close to a wall. If it is, it attempts to push it away. If it tries to push 256 times, and the object is still too close, it returns -1.
*x | Object's X coordinate. |
*y | Object's Y coordinate. |
*z | Object's Z coordinate. |
*sectnum | Object's sector. |
walldist | Distance to avoid walls by. |
ceildist | Distance to avoid ceilings by. |
flordist | Distane to avoid floors by. |
cliptype | See below. |
void qloadkvx | ( | long | voxindex, |
char * | filename | ||
) |
Load a voxel.
This function will load a voxel that can be used to replace a sprite.
See notes below.
voxindex | The voxel number to use. |
*filename | The voxel file to load. |
void rotatepoint | ( | long | xpivot, |
long | ypivot, | ||
long | x, | ||
long | y, | ||
short | daang, | ||
long * | x2, | ||
long * | y2 | ||
) |
Rotate / translate a point.
This function is a very convenient and fast math helper function. Rotate points easily with this function without having to juggle your cosines and sines.
xpivot | X coordinate of point to pivot about. |
ypivot | Y coordinate of point to pivot about. |
x | X coordinate of point to translate. |
y | Y coordinate of point to translate. |
daang | Angle to rotate (CW, relative) |
*x2 | X coordinate of the translated point. |
*y2 | Y coordinate of the translated point. |
void rotatesprite | ( | long | sx, |
long | sy, | ||
long | z, | ||
short | a, | ||
short | picnum, | ||
signed char | dashade, | ||
char | dapalnum, | ||
char | dastat, | ||
long | cx1, | ||
long | cy1, | ||
long | cx2, | ||
long | cy2 | ||
) |
Rotate and draw a sprite on the screen.
This function will rotate and draw a sprite onto the screen. See notes for proper usage.
sx | X center of sprite to draw. |
sy | Y center of sprite to draw. |
z | Zoom to draw with. |
a | Angle to draw at. |
picnum | The tile to draw. |
dashade | The shade to draw with. |
dapalnum | The palette to draw with. |
dastat | Drawing options. |
cx1 | Upper left of screen clipping box X. |
cy1 | Upper left of screen clipping box Y. |
cx2 | Lower right of screen clipping box X. |
cy2 | Lower right of screen clipping box Y. |
int saveboard | ( | char * | filename, |
long * | daposx, | ||
long * | daposy, | ||
long * | daposz, | ||
short * | daang, | ||
short * | dacursectnum | ||
) |
Saves a map to disk.
This function dumps the working map to disk, using the pointers you pass as the starting location. If no extention is given to filename, .MAP is assumed.
filename | The filename to save. |
*daposx | A pointer containing the starting X coordinate. |
*daposy | A pointer containing the starting Y coordinate. |
*daposz | A pointer containing the starting Z coordinate. |
*daang | A pointer containing the starting angle. |
*dacursectnum | A pointer containing the starting sector. |
int screencapture | ( | char * | filename, |
char | inverseit | ||
) |
Take a screenshot.
This function will dump a picture of the current screen to a file.
Set inverseit to 1 if you want the colors inverted.
*filename | The filename to write to. |
inverseit | Set to 1 if you want the colors inverted. |
int sectorofwall | ( | short | theline | ) |
A fast routine to find the sector that owns a certain wall.
This function will find the sector that owns the wall theline.
theline | The wall to lookup. |
void setaspect | ( | long | daxrange, |
long | daaspect | ||
) |
Set aspect ratio and viewing range angle.
This function sets the aspect ratio and viewing range angle of the engine. Used for weird video modes or special effects.
daxrange | Sets the viewing range angle. |
daaspect | Sets the aspect ratio. |
void setbrightness | ( | char | dabrightness, |
unsigned char * | dapal | ||
) |
Adjust the gamma of a VGA palette.
This function will adjust the brightness of colors in dapal.
dabrightness | The gamma level. Accepted range of 0-15, where 0 is the darkest and 15 is the lightest. |
*dapal | A pointer to a standard 768 byte VGA palette. |
void setfirstwall | ( | short | sectnum, |
short | newfirstwall | ||
) |
Sets the first wall of a sector.
This function sets the first wall of a sector. It can be used to change the hinge wall of a slope, among other things.
sectnum | The sector to modify. |
newfirstwall | The wall to set as the first wall. |
int setgamemode | ( | char | davidoption, |
long | daxdim, | ||
long | daydim | ||
) |
Set the video mode.
This function sets the video mode. If you change the mode in your program, you must call this again to reset the mode before using the build drawing functions.
davidoption | The video modeset to use (0-6). Allowed options:
|
daxdim | The x resolution. (must be 320 if param 1 != 1.) |
daydim | The y resolution. (must be 200 if param 1 != 1.) |
int setsprite | ( | short | spritenum, |
long | newx, | ||
long | newy, | ||
long | newz | ||
) |
Puts a sprite somewhere, without checking for validity.
This function will move a sprite to anywhere on the map, regardless of whether the new place is valid.
spritenum | The sprite to move. |
newx | The X coordinate to move to. |
newy | The Y coordinate to move to. |
newz | The Z coordinate to move to. |
void setview | ( | long | x1, |
long | y1, | ||
long | x2, | ||
long | y2 | ||
) |
Sets the viewing window for 3D mode.
This function will cause the engine to draw the 3D view in a specified portion of the screen.
x1 | upper left X coordinate. |
y1 | upper left Y coordinate. |
x2 | lower right X coordinate. |
y2 | lower right Y coordinate. |
void setviewback | ( | void | ) |
Shows the screen as it was previous to the last setviewtotile.
This function will show the screen as it was before the last call to setviewtotile.
void setviewtotile | ( | short | tilenume, |
long | xsiz, | ||
long | ysiz | ||
) |
Shows a tile on screen, saving the previous view.
This function will show a tile on screen, saving the previous view. You can call this multiple times, and calling setviewback will go to the last view. If you keep calling setback, you will eventually get back to your original screen. All drawing starts in the top left corner.
tilenume | Tile to show. |
xsiz | X size to draw. |
ysiz | Y size to draw. |
void squarerotatetile | ( | short | tilenume | ) |
Rotates a tile's image.
This function will rotate the graphic of a tile. It only works with square tiles.
tilenume | The tile to perform the rotation on. |
void uninitengine | ( | void | ) |
Uninitialize the Build Engine.
This function frees the buffers used by the build engine. You should call this function once before you end your program.
void updatesector | ( | long | x, |
long | y, | ||
short * | sectnum | ||
) |
Update a sector pointer, given x and y values.
This function updates a pointer with the sector number occupied by an x and y value.
x | The x coordinate to look up. |
y | The y coordinate to look up. |
*sectnum | A pointer to the variable you want to write the result into. |