ribbmaplib
This library was written for the game Blitz Bombers by Reflective
Images. It reads its two kinds of data file, maps and scenarios, which
are IFF files of the types BMAP and SCEN. The program loads a file
into memory itself and hands its address to SetBBMapLoc or
SetBBScenarioLoc; the other commands then look up the chunks of that
file. One map and one scenario can be chosen at a time.
Most functions return the address of the data of a chunk, or a number
stored in it, and 0 if the file has no such chunk. The string
functions return the names stored in the file. The library only reads
the files; the meaning of the data is that of the game and is not
described here. BBGetPalette is the one command that changes
something: it copies the colours of a scenario into a palette object.
Choose the file before the other commands: until then they return 0 or an empty string. The chunks are found by walking the file from chunk to chunk, within the length of the file. Behind a chunk of odd length the walk skips the pad byte that the IFF standard puts there; a file written without pad bytes is read as well.
With runtime error checking, BBShadowValue with a shadow set the
scenario does not have stops the program with the runtime error
“Shadow set must lie in the SHDW chunk”.
With a scenario file loaded at address m:
If SetBBScenarioLoc(m)
NPrint BBScenarioName," by ",BBScenarioAuthor
NPrint "Level ",BBScenarioLevel
EndIfThe fixed bugs of the library are listed in Fixes in ribbmaplib.
Library number 34.
Commands
BBDestructLoc
The address of the data of the DEST chunk of the scenario, 0 without it.
Function, result .l. No help text.
No arguments.
BBGetPalette
Copies the colours of the COLR chunk of the scenario into a palette object, from its first to its last colour number. A palette with too few colours is enlarged.
Statement. Help text: palette#
Arguments: .w
Nothing happens without the chunk, or when its first colour number is above its last. Only the colours the chunk holds are copied: a last colour number beyond them is cut to the last colour in the chunk.
BBMapData
The address of the map data, the data of its MDAT chunk; 0 without it.
Function, result .l. Help text: - returns location of actual map data
No arguments.
BBMapDBOverLay
The address of the destructible block overlay of the map, the data of its DBOL chunk; 0 without it.
Function, result .l. Help text: - returns map destructible block overlay (or zero for none)
No arguments.
BBMapHeight
The height of the map, from its information chunk; 0 before the first SetBBMapLoc.
Function, result .w. Help text: - returns map height
No arguments.
BBMapInfo
The address of the information chunk (MFRM) of the map; 0 before the first SetBBMapLoc.
Function, result .l. Help text: - returns map information chunk
No arguments.
BBMapName$
The name of the map, from its NAME chunk; an empty string without it.
Function, result $. Help text: - returns the name of the map
No arguments.
BBMapObjects
The address of the one player objects of the map, the data of its OBJS chunk; 0 without it.
Function, result .l. Help text: - returns one player object chunk (or zero for none)
No arguments.
BBMapOnePlayerInfo
The address of the one player data of the map, the data of its 1PLY chunk; 0 without it.
Function, result .l. Help text: - returns one player data chunk (or zero for none)
No arguments.
BBMapPowerUps
The address of the custom power-ups of the map, the data of its PWUP chunk; 0 without it.
Function, result .l. Help text: - returns location of custom powerups
No arguments.
BBMapPUMask
The address of the power-up mask of the map, the data of its PWMK chunk; 0 without it.
Function, result .l. Help text: - returns map powerup mask (or zero for none)
No arguments.
BBMapScenarioID
The scenario id of the map, from its information chunk (MFRM); 0 before the first SetBBMapLoc.
Function, result .l. Help text: - returns scenarios of map
No arguments.
BBMapStartPos
The address of the start positions of the map, the data of its STRT chunk; 0 without it.
Function, result .l. Help text: - returns location of start position data
No arguments.
BBMapWidth
The width of the map, from its information chunk; 0 before the first SetBBMapLoc.
Function, result .w. Help text: - returns map width
No arguments.
BBNumBackGround
The number of background shapes, the first word of the SHAP chunk of the scenario; 0 without it.
Function, result .w. No help text.
No arguments.
BBNumBaddies
The number of baddies, the first byte of the BAD! chunk of the scenario; 0 without it.
Function, result .w. Help text: - returns number of baddies
No arguments.
BBNumDestruct
The number of destructible block shapes, the second word of the SHAP chunk of the scenario; 0 without it.
Function, result .w. No help text.
No arguments.
BBNumIndestruct
The number of indestructible block shapes, the third word of the SHAP chunk of the scenario; 0 without it.
Function, result .w. No help text.
No arguments.
BBNumTunnels
The number of tunnels, the first word of the TUNL chunk of the scenario; 0 without it.
Function, result .w. No help text.
No arguments.
BBScenarioAuthor
The author of the scenario, the second string of its ANNO chunk; an empty string without the chunk.
Function, result $. No help text.
No arguments.
BBScenarioBaddiesLoc
The address of the baddies of the scenario, the data of its BAD! chunk behind its first two bytes; 0 without it.
Function, result .l. No help text.
No arguments.
BBScenarioDepth
The number stored in the DEPF chunk of the scenario, 0 without it.
Function, result .w. No help text.
No arguments.
BBScenarioHighCol
The number of the last colour in the COLR chunk of the scenario, 0 to 255; 0 without the chunk.
Function, result .w. No help text.
No arguments.
BBScenarioLevel
The level number stored in the LEVL chunk of the scenario, 0 without it.
Function, result .w. No help text.
No arguments.
BBScenarioLowCol
The number of the first colour in the COLR chunk of the scenario, 0 to 255; 0 without the chunk.
Function, result .w. No help text.
No arguments.
BBScenarioName
The name of the scenario, the first string of its ANNO chunk; an empty string without the chunk.
Function, result $. No help text.
No arguments.
BBScenarioPalette
The address of the colours of the scenario in its COLR chunk, three bytes red, green and blue per colour; 0 without the chunk.
Function, result .l. No help text.
No arguments.
BBScenarioPrefix
The long stored in the PRFX chunk of the scenario, 0 without it.
Function, result .l. No help text.
No arguments.
BBScenarioShapeLoc
The address of the graphics of the scenario, the data of its GFX! chunk; 0 without it.
Function, result .l. No help text.
No arguments.
BBScenarioSounds
The address of the sounds of the scenario, the data of its SFX! chunk; 0 without it.
Function, result .l. No help text.
No arguments.
BBShadowValue
The long number shadowset (counted from 0) of the SHDW chunk of the scenario, 0 without the chunk.
Function, result .l. Help text: shadowset
Arguments: .w
With runtime error checking, a shadow set outside the chunk stops the program with the runtime error “Shadow set must lie in the SHDW chunk”. Without it, the number is not checked, and such a set reads the bytes behind the chunk.
BBTunnelHoles
The long behind the first word of the TUNL chunk of the scenario, 0 without it.
Function, result .l. No help text.
No arguments.
BBTunnelsLoc
The address of the tunnel data, the TUNL chunk of the scenario from its ninth byte on; 0 without it.
Function, result .l. No help text.
No arguments.
SetBBMapLoc
Chooses the map file at address for the BBMap functions and finds its information chunk. Returns -1, or 0 if the file is not an IFF file of type BMAP; then the map chosen before stays.
Statement or function, result .l. Help text: address
Arguments: .l
For a map without an information chunk (MFRM), BBMapScenarioID,
BBMapWidth, BBMapHeight and BBMapInfo return 0; the other
chunks of the map can be used.
SetBBScenarioLoc
Chooses the scenario file at address for the scenario functions. Returns -1, or 0 if the file is not an IFF file of type SCEN; then the scenario chosen before stays.
Statement or function, result .l. Help text: address
Arguments: .l