For GLOOM (Amiga) style games.
File: |
gloom.lib, gloom.dll |
Version: |
1.0 |
Author: |
Marcus Johansson |
GLOOM was a game developed for Amiga computers by Black Magic Software a long long time ago. Technically it landed somewhere between Wolfenstein and Doom. With this library you can make games that resembles GLOOM.
Initialization |
|||
Name |
Parameters |
Brief description |
|
function |
fov#, renderW, renderH |
Initialize library. |
|
procedure |
sizeX, sizeZ |
Initialize map. |
|
procedure |
wallHeight# |
Set wall height. |
|
procedure |
r, g, b, zMin#, zMax#, steps |
Set fog and the far clip plane. |
|
function |
Get the red color component of the fog. |
||
function |
Get the green color component of the fog. |
||
function |
Get the blue color component of the fog. |
||
Walls |
|||
Name |
Parameters |
Brief description |
|
procedure |
img, x1#, z1#, x2#, z2#, repeat#, id |
Add a wall. |
|
Walls |
|||
Name |
Parameters |
Brief description |
|
procedure |
x1#, z1#, x2#, z2#, repeat#, id |
Add an invisible wall. |
|
function |
img, x1#, z1#, x2#, z2#, repeat#, id |
Add an indexed wall. |
|
function |
x1#, z1#, x2#, z2#, repeat#, id |
Add an invisible indexed wall. |
|
procedure |
index |
Remove a wall. |
|
function |
index |
Get complete information about a wall. |
|
procedure |
index, x1#, z1#, x2#, z2# |
Set wall position. |
|
procedure |
index, img |
Set wall texture. |
|
procedure |
index, rep# |
Set the repeat count of a wall's texture. |
|
procedure |
index, id |
Set an identifier for a wall. |
|
procedure |
img, &coords#[][] |
Add walls from a polyline. |
|
procedure |
&coords#[][] |
Add invisible walls from a polyline. |
|
function |
img, &coords#[][] |
Add indexed walls from a polyline. |
|
function |
&coords#[][] |
Add invisible indexed walls from a polyline. |
|
procedure |
index, &coords#[][] |
Change positions of a wall sequence already added with GLOOM_AddIndexedPolyWall. |
|
Floor and ceiling |
|||
Name |
Parameters |
Brief description |
|
procedure |
x, z, img |
Set floor texture for the square unit at discrete position (x, y). |
|
procedure |
x, z, img |
Set ceiling texture for the square unit at discrete position (x, y). |
|
procedure |
img |
Cover entire floor with one texture. |
|
procedure |
img |
Cover entire ceiling with one texture. |
|
function |
x, z |
Get floor texture. |
|
function |
x, z |
Get ceiling texture. |
|
Sprites |
|||
Name |
Parameters |
Brief description |
|
procedure |
img, x#, z#, y#, h#, imgCel, additiveDraw |
Add a sprite. |
|
function |
img, x#, z#, y#, h#, imgCel, additiveDraw |
Add an indexed sprite. |
|
procedure |
index, x#, z#, y# |
Set sprite position. |
|
procedure |
index, img, imgCel |
Set sprite texture. |
|
procedure |
index |
Remove sprite. |
|
procedure |
Remove all sprites. |
||
Player |
|||
Name |
Parameters |
Brief description |
|
procedure |
xPos#, zPos#, angle# |
Render view. |
|
procedure |
&x#, &z#, r# |
Push circular object away from the walls.. |
|
function |
x#, z#, dx#, dz# |
Cast a ray and get information about the hit wall. |
|
function |
x#, z#, dx#, dz# |
Return distance to the closest wall from a position and direction. |
|
function |
x#, z#, a#, maxDistance# |
Return index of a wall that is faced from a specific position and angle. |
|
function |
x#, z#, a#, maxDistance# |
Return ID of a wall that is faced from a specific position and angle. |
|
function |
x#, z#, a#, maxDistance# |
Return texture of a wall that is faced from a specific position and angle. |
|
function |
x1#, z1#, x2#, z2# |
Return true if a point is visible from another point. |
|
Map files |
|||
Name |
Parameters |
Brief description |
|
function |
filename$ |
Load a map created with the GLOOM Map Editor. |
|
function |
Return wall data of a loaded map. |
||
function |
Return width (x size) of a loaded map. |
||
function |
Return height (z size) of a loaded map. |
||
function |
Return discrete grid data of map. |
||
function |
gridLayer |
Return values of a specific grid layer. |
|
function |
gridLayer, value |
Return the positions in the specified grid layer that contains a certain value. |
|
procedure |
Automatically build walls from data loaded with GLOOM_LoadMap. |
||
procedure |
gridLayer |
Automatically build floor from data loaded with GLOOM_LoadMap. |
|
procedure |
gridLayer |
Automatically build ceiling from data loaded with GLOOM_LoadMap. |
|
Advanced |
|||
Name |
Parameters |
Brief description |
|
procedure |
Clear the transformation used when adding/modifying walls. |
||
procedure |
x#, z# |
Translate upcomming wall positions. |
|
procedure |
a# |
Rotate upcomming wall positions. |
|
procedure |
x#, z# |
Scale upcomming wall positions. |
function GLOOM_Init ( fov#, renderW, renderH )Initialize the library. The function will return false if gloom.dll could not be loaded. Make sure to include it next to your executable file.
Return value [ Back ] |
procedure GLOOM_InitMap ( sizeX, sizeZ )Before adding walls to a map you need to initialize its size. A unit (1) is twice as long as the distance between the floor and the player's eyes (0.5). Walls that are placed outside the boundaries of the map will not be rendered. Each square unit may contain a floor and ceiling texture.
[ Back ] |
procedure GLOOM_SetWallHeight ( wallHeight# )Wall height can only be set for the entire map. With the player's eyes at 0.5, the default wall height is 1.0.
[ Back ] |
procedure GLOOM_SetFog ( r, g, b, zMin#, zMax#, steps )You can use this function to set a fog color and/or the far clip plane for rendering. Walls at a greater distance than zMax from the view point will not be rendered. If you don't want a fog effect you can set zMin and zMax to the same value (default 32.0). If you set the steps parameter to anything but 0, the fog will only have that many steps (6 yields 6 steps of fog) for a retro touch.
[ Back ] |
function GLOOM_FogR ( )
Return value [ Back ] |
function GLOOM_FogG ( )
Return value [ Back ] |
function GLOOM_FogB ( )
Return value [ Back ] |
procedure GLOOM_AddWall ( img, x1#, z1#, x2#, z2#, repeat#, id )Add a textured wall between two points on the (2D) map. If you want to identify this wall later on, with GLOOM_FacingWallID, you can set an identifier for it with ID.
[ Back ] |
procedure GLOOM_AddInvisibleWall ( x1#, z1#, x2#, z2#, repeat#, id )Same as GLOOM_AddWall, but makes the wall invisible. You can use this in combination with sprites for static objects like barrels and pillars.
[ Back ] |
function GLOOM_AddIndexedWall ( img, x1#, z1#, x2#, z2#, repeat#, id )Same as GLOOM_AddWall, but returns the internal index (starting at 0) of the wall. If you want to change a wall's properties later on, you do it through this index.
Return value [ Back ] |
function GLOOM_AddInvisibleIndexedWall ( x1#, z1#, x2#, z2#, repeat#, id )Same as GLOOM_AddIndexedWall, but makes the wall invisible. You can use this in combination with sprites for static objects like barrels and pillars.
Return value [ Back ] |
procedure GLOOM_RemoveWall ( index )Remove wall with the specified index.
[ Back ] |
function GLOOM_GetWallInfo? ( index ) Return all stored information about a wall with a certain index. The returned object will contain the following fields:
Return value [ Back ] |
procedure GLOOM_SetWallPosition ( index, x1#, z1#, x2#, z2# )Change the position of an already added wall using the index returned from GLOOM_AddIndexedWall.
[ Back ] |
procedure GLOOM_SetWallTexture ( index, img )Change the texture/image of an already added wall using the index returned from GLOOM_AddIndexedWall.
[ Back ] |
procedure GLOOM_SetWallTextureRepeat ( index, rep# )Change the texture repeat count of an already added wall using the index returned from GLOOM_AddIndexedWall.
[ Back ] |
procedure GLOOM_SetWallID ( index, id )Change the identifier an already added wall using the index returned from GLOOM_AddIndexedWall.
[ Back ] |
procedure GLOOM_AddPolyWall ( img, &coords#[][] )Add walls from a polyline in the format [[x1, z1], [x2, z2] ... [xN, zN]]. The first wall will use the start and end points (x1, z1) and (x2, z2). The second wall will use the start and end points (x2, z2) and (x3, z3), and so on.
[ Back ] |
procedure GLOOM_AddInvisiblePolyWall ( &coords#[][] )Same as GLOOM_AddPolyWall, but makes the walls invisible. You can use this in combination with sprites for static objects like barrels and pillars.
[ Back ] |
function GLOOM_AddIndexedPolyWall ( img, &coords#[][] )Same as GLOOM_AddPolyWall, but returns the index of the first wall. The index of the following walls will be the returned index + 1, + 2 and so on.
Return value [ Back ] |
function GLOOM_AddInvisibleIndexedPolyWall ( &coords#[][] )Same as GLOOM_AddIndexedPolyWall, but makes the walls invisible. You can use this in combination with sprites for static objects like barrels and pillars.
Return value [ Back ] |
procedure GLOOM_PositionPolyWall ( index, &coords#[][] )Change positions of a wall sequence using the index returned from GLOOM_AddIndexedPolyWall.
[ Back ] |
procedure GLOOM_SetFloor ( x, z, img )
[ Back ] |
procedure GLOOM_SetCeiling ( x, z, img )
[ Back ] |
procedure GLOOM_CoverFloor ( img )
[ Back ] |
procedure GLOOM_CoverCeiling ( img )
[ Back ] |
function GLOOM_GetFloor ( x, z )Return floor texture/image at specified position.
Return value [ Back ] |
function GLOOM_GetCeiling ( x, z )Return ceiling texture/image at specified position.
Return value [ Back ] |
procedure GLOOM_AddSprite ( img, x#, z#, y#, h#, imgCel, additiveDraw )Add a sprite at specified position. The Y coordinate is measured from the floor (0.0) and up.
[ Back ] |
function GLOOM_AddIndexedSprite ( img, x#, z#, y#, h#, imgCel, additiveDraw )Same as GLOOM_AddSprite but returns the internal index of the sprite. This index can be used for modifying and removing the sprite.
Return value [ Back ] |
procedure GLOOM_SetSpritePosition ( index, x#, z#, y# )Set position of a sprite added with GLOOM_AddIndexedSprite.
[ Back ] |
procedure GLOOM_SetSpriteTexture ( index, img, imgCel )Set texture of sprite added with GLOOM_AddIndexedSprite.
[ Back ] |
procedure GLOOM_RemoveSprite ( index )Permanently remove sprite added with GLOOM_AddIndexedSprite.
[ Back ] |
procedure GLOOM_ClearSprites ( )Remove all sprites. [ Back ] |
procedure GLOOM_Render ( xPos#, zPos#, angle# )Render view from specified view position and angle.
[ Back ] |
procedure GLOOM_PushOut ( &x#, &z#, r# )This function is meant for collision handling. It will push an object at position (x, z) with radius r out from the walls. Call it, for example, right after moving a player or enemy.
[ Back ] |
function GLOOM_CastRay? ( x#, z#, dx#, dz# ) Return all stored information about any wall hit by a ray going from (x, z) in the direction (dx dz). The returned object will contain the following fields:
Return value [ Back ] |
function GLOOM_ClosestWallDistance# ( x#, z#, dx#, dz# )Return distance to the closest wall from a position and direction.
Return value [ Back ] |
function GLOOM_FacingWall ( x#, z#, a#, maxDistance# )Return the index of a wall that someone standing at (x, z) is facing in the angle a (degrees). maxDistance is the max allowed distance to the wall. If no wall is faced, -1 is returned.
Return value [ Back ] |
function GLOOM_FacingWallID ( x#, z#, a#, maxDistance# )Return the ID of a wall that someone standing at (x, z) is facing in the angle a (degrees). maxDistance is the max allowed distance to the wall. If no wall is faced, -1 is returned.
Return value [ Back ] |
function GLOOM_FacingTexture ( x#, z#, a#, maxDistance# )Return the texture/image of a wall that someone standing at (x, z) is facing in the angle a (degrees). maxDistance is the max allowed distance to the wall. If no wall is faced, -1 is returned.
Return value [ Back ] |
function GLOOM_Visible ( x1#, z1#, x2#, z2# )Return true if point (x2, z2) is visible from point (x1, z1). If the function returns false, there's a wall between the points.
Return value [ Back ] |
function GLOOM_LoadMap ( filename$ )This loads a map created with the GLOOM Map Editor but doesn't do anything with the loaded data. You can use GLOOM_LoadedMapWalls and GLOOM_LoadedMapGrid to get all the information about the loaded map and do what you want with the data. You can also use GLOOM_BuildLoadedMapWalls, GLOOM_BuildLoadedMapFloor and GLOOM_BuildLoadedMapCeiling to automaically build the actual map, but then you'll lose lots of control.
Return value [ Back ] |
function GLOOM_LoadedMapWalls?[] ( ) Return wall data of a map loaded with GLOOM_LoadMap. You can get the number walls by calling sizeof on the returned object array. Each wall object has the following fields:
Return value [ Back ] |
function GLOOM_LoadedMapWidth ( )Return width of a loaded map. You can pass this to GLOOM_InitMap.
Return value [ Back ] |
function GLOOM_LoadedMapHeight ( )Return height of a loaded map. You can pass this to GLOOM_InitMap.
Return value [ Back ] |
function GLOOM_LoadedMapGrid[][][] ( )Return a three dimensional array containing the values of the layers Grid 1, Grid 2, Grid 3 and Grid 4 in the GLOOM Map Editor. The values are aranged as [X COORDINATE][Z COORDINATE][0..3], where 0 is Grid 1, 1 is Grid 2, and so on.
Return value [ Back ] |
function GLOOM_LoadedMapGridLayer?[][] ( gridLayer )Return a two dimensional array containing the values of the specified grid layer. It's an object array in the form [X COORDINATE][Z COORDINATE], where each object has a field named value.
Return value [ Back ] |
function GLOOM_LoadedMapGridPositions?[] ( gridLayer, value )Return an object array with the positions, in the specified grid layer, that contains a certain value. GLOOM_LoadedMapGridPositions(3, 10) will return an array with the positions of all value 10:s in grid layer 3. Each object in the array has an integer x and z field.
Return value [ Back ] |
procedure GLOOM_BuildLoadedMapWalls ( )This will ADD walls from a map loaded with GLOOM_LoadMap. It assumes that the loaded values represent already loaded images/textures. The texture repeat will be set to the integer length of the wall, rounded down but never set to anything lower than 1. [ Back ] |
procedure GLOOM_BuildLoadedMapFloor ( gridLayer )Automatically build floor from data loaded with GLOOM_LoadMap. This will assume that the values for the given grid layer represent already loaded images/textures. Pass 1 as gridLayer for grid layer 1, 2 for grid layer 2 and so on. Before calling this, you must have set the map width and height with GLOOM_InitMap so that it matches the loaded data.
[ Back ] |
procedure GLOOM_BuildLoadedMapCeiling ( gridLayer )Automatically build ceiling from data loaded with GLOOM_LoadMap. This will assume that the values for the given grid layer represent already loaded images/textures. Pass 1 as gridLayer for grid layer 1, 2 for grid layer 2 and so on. Before calling this, you must have set the map width and height with GLOOM_InitMap so that it matches the loaded data.
[ Back ] |
procedure GLOOM_ClearTransformation ( )Don't forget to call this after adding walls if you have used GLOOM_Translate, GLOOM_Rotate or GLOOM_Scale to position them. [ Back ] |
procedure GLOOM_Translate ( x#, z# )Apply translation to the transformation matrix used for upcomming wall positions.
[ Back ] |
procedure GLOOM_Rotate ( a# )Apply rotation to the transformation matrix used for upcomming wall positions.
[ Back ] |
procedure GLOOM_Scale ( x#, z# )Apply scaling to the transformation matrix used for upcomming wall positions.
[ Back ] |
Generated with NLDoc 20170629.