|
BB2 C port
API reference: Blitz libraries in C and the shared code
|
Data Structures | |
| struct | form |
| struct | mfrm |
Macros | |
| #define | FN0(t, code, name, help) |
| #define | ID(a, b, c, d) |
| #define | LONGAT(p) |
| #define | WORDAT(p) |
| #define | HI 0xffff0000UL /* MOVEQ #-1,d0 of the chunk search */ |
| #define | PDATA(p) |
Functions | |
| void | _setbbmaploc (void) |
| void | _setbbscenarioloc (void) |
| void | _bbscenarioname (void) |
| void | _bbscenarioauthor (void) |
| void | _bbscenariodepth (void) |
| void | _bbscenarioshapes (void) |
| void | _bbscenariosounds (void) |
| void | _bbscenariobaddies (void) |
| void | _bbscenariopalette (void) |
| void | _bbscenariolowcol (void) |
| void | _bbscenariohighcol (void) |
| void | _bbscenariolevel (void) |
| void | _bbnumbackground (void) |
| void | _bbnumdestruct (void) |
| void | _bbnumindestruct (void) |
| void | _bbscenarioprefix (void) |
| void | _bbnumtunnels (void) |
| void | _bbshadowvalue (void) |
| void | _bbtunnelholes (void) |
| void | _bbtunnelsloc (void) |
| void | _bbgetpalette (void) |
| void | _bbdestructloc (void) |
| void | _bbmapscenarioid (void) |
| void | _bbmapwidth (void) |
| void | _bbmapheight (void) |
| void | _bbmappowerups (void) |
| void | _bbmapdata (void) |
| void | _bbmapstartpos (void) |
| void | _bbmapname (void) |
| void | _bbmapinfo (void) |
| void | _bbmappumask (void) |
| void | _bbmapdboverlay (void) |
| void | _bbmaponeplayerinfo (void) |
| void | _bbmapobjects (void) |
| void | _bbnumbaddies (void) |
| void | shadowchk (void) |
| static void | codeinit (void) |
| init: no map, no scenario, nothing cached. | |
| static void | codefinit (void) |
| finit: does nothing (RTS). | |
| FN0 (BL_STRING, _bbscenarioname, "BBScenarioName", "") | |
| FN0 (BL_STRING, _bbscenarioauthor, "BBScenarioAuthor", "") | |
| FN0 (BL_WORD, _bbscenariodepth, "BBScenarioDepth", "") | |
| FN0 (BL_LONG, _bbscenarioshapes, "BBScenarioShapeLoc", "") | |
| FN0 (BL_LONG, _bbscenariosounds, "BBScenarioSounds", "") | |
| FN0 (BL_LONG, _bbscenariobaddies, "BBScenarioBaddiesLoc", "") | |
| FN0 (BL_LONG, _bbscenariopalette, "BBScenarioPalette", "") | |
| FN0 (BL_WORD, _bbscenariolowcol, "BBScenarioLowCol", "") | |
| FN0 (BL_WORD, _bbscenariohighcol, "BBScenarioHighCol", "") | |
| FN0 (BL_WORD, _bbscenariolevel, "BBScenarioLevel", "") | |
| FN0 (BL_WORD, _bbnumbackground, "BBNumBackGround", "") | |
| FN0 (BL_WORD, _bbnumdestruct, "BBNumDestruct", "") | |
| FN0 (BL_WORD, _bbnumindestruct, "BBNumIndestruct", "") | |
| FN0 (BL_LONG, _bbscenarioprefix, "BBScenarioPrefix", "") | |
| FN0 (BL_WORD, _bbnumtunnels, "BBNumTunnels", "") | |
| FN0 (BL_LONG, _bbtunnelholes, "BBTunnelHoles", "") | |
| FN0 (BL_LONG, _bbtunnelsloc, "BBTunnelsLoc", "") | |
| FN0 (BL_LONG, _bbdestructloc, "BBDestructLoc", "") | |
| FN0 (BL_LONG, _bbmapscenarioid, "BBMapScenarioID", "- returns scenarios of map") | |
| FN0 (BL_WORD, _bbmapwidth, "BBMapWidth", "- returns map width") | |
| FN0 (BL_WORD, _bbmapheight, "BBMapHeight", "- returns map height") | |
| FN0 (BL_LONG, _bbmappowerups, "BBMapPowerUps", "- returns location of custom powerups") | |
| FN0 (BL_LONG, _bbmapdata, "BBMapData", "- returns location of actual map data") | |
| FN0 (BL_LONG, _bbmapstartpos, "BBMapStartPos", "- returns location of start position data") | |
| FN0 (BL_STRING, _bbmapname, "BBMapName$", "- returns the name of the map") | |
| FN0 (BL_LONG, _bbmapinfo, "BBMapInfo", "- returns map information chunk") | |
| FN0 (BL_LONG, _bbmappumask, "BBMapPUMask", "- returns map powerup mask (or zero for none)") | |
| FN0 (BL_LONG, _bbmapdboverlay, "BBMapDBOverLay", "- returns map destructible block overlay (or zero for none)") | |
| FN0 (BL_LONG, _bbmaponeplayerinfo, "BBMapOnePlayerInfo", "- returns one player data chunk (or zero for none)") | |
| FN0 (BL_LONG, _bbmapobjects, "BBMapObjects", "- returns one player object chunk (or zero for none)") | |
| FN0 (BL_WORD, _bbnumbaddies, "BBNumBaddies", "- returns number of baddies") | |
| static UBYTE * | search (ULONG id, UBYTE *loc, UBYTE *end, ULONG *last, UBYTE **lastaddr) |
| static UBYTE * | findchunk (ULONG id) |
| static UBYTE * | findmapchunk (ULONG id) |
| static BB_BOOL | setbbscenarioloc_c (struct form *form) |
| SetBBScenarioLoc address: the scenario file ("FORM" .. "SCEN") in memory for the BBScenario.../BBNum.../BBTunnel... functions. | |
| static BB_BOOL | setbbmaploc_c (struct form *form) |
| SetBBMapLoc address: the map file ("FORM" .. "BMAP") in memory for the BBMap... functions; finds its MFRM chunk. | |
| static ULONG | chunkword (ULONG id, int off) |
| static ULONG | chunkaddr (ULONG id, int off) |
| static ULONG | bbscenariolevel_c (void) |
| BBScenarioLevel: the word of the LEVL chunk. | |
| static ULONG | bbscenariodepth_c (void) |
| BBScenarioDepth: the word of the DEPF chunk. | |
| static ULONG | bbscenarioprefix_c (void) |
| BBScenarioPrefix: the long of the PRFX chunk. | |
| static ULONG | bbscenariopalette_c (void) |
| BBScenarioPalette: the colours of the COLR chunk (behind its low and high byte). | |
| static ULONG | bbscenariolowcol_c (void) |
| BBScenarioLowCol: the first colour of the COLR chunk (its byte 0). | |
| static ULONG | bbscenariohighcol_c (void) |
| BBScenarioHighCol: the last colour of the COLR chunk (its byte 1). | |
| static ULONG | bbnumbackground_c (void) |
| BBNumBackGround: the word at +0 of the SHAP chunk. | |
| static ULONG | bbnumdestruct_c (void) |
| BBNumDestruct: the word at +2 of the SHAP chunk. | |
| static ULONG | bbnumindestruct_c (void) |
| BBNumIndestruct: the word at +4 of the SHAP chunk. | |
| static ULONG | bbnumtunnels_c (void) |
| BBNumTunnels: the word at +0 of the TUNL chunk. | |
| static ULONG | bbnumbaddies_c (void) |
| BBNumBaddies: the byte at +0 of the BAD! chunk. | |
| static ULONG | bbshadowvalue_c (ULONG set) |
| BBShadowValue shadowset: the long number set of the SHDW chunk (ASL.w #2: a word index). | |
| static ULONG | bbtunnelsloc_c (void) |
| BBTunnelsLoc: the data of the TUNL chunk from +8 on. | |
| static ULONG | bbtunnelholes_c (void) |
| BBTunnelHoles: the long at +2 of the TUNL chunk. | |
| static ULONG | bbscenarioshapes_c (void) |
| BBScenarioShapeLoc: the data of the GFX! chunk. | |
| static ULONG | bbscenariosounds_c (void) |
| BBScenarioSounds: the data of the SFX! chunk. | |
| static ULONG | bbscenariobaddies_c (void) |
| BBScenarioBaddiesLoc: the data of the BAD! chunk from +2 on. | |
| static ULONG | bbdestructloc_c (void) |
| BBDestructLoc: the data of the DEST chunk. | |
| static ULONG | copystring (const UBYTE *text) |
| static ULONG | bbscenarioname_c (void) |
| BBScenarioName: the name in the ANNO chunk, at a3 (without its 0, a3 behind the last character). | |
| static ULONG | bbscenarioauthor_c (void) |
| BBScenarioAuthor: the author in the ANNO chunk (the string behind the name's 0, at an even address), at a3 like BBScenarioName. | |
| static void | bbgetpalette_c (struct bb_palette *pal) |
| BBGetPalette palette#: the colours of the COLR chunk into a palette object. | |
| static ULONG | mapchunkaddr (ULONG id) |
| static ULONG | bbmapscenarioid_c (void) |
| BBMapScenarioID: the scenario id of the map (+0 of its MFRM chunk). | |
| static ULONG | bbmapwidth_c (ULONG prev) |
| BBMapWidth: the width of the map (+4 of its MFRM chunk). | |
| static ULONG | bbmapheight_c (ULONG prev) |
| BBMapHeight: the height of the map (+6 of its MFRM chunk). | |
| static ULONG | bbmapinfo_c (void) |
| BBMapInfo: the map's information chunk (the data of MFRM). | |
| static ULONG | bbmappowerups_c (void) |
| BBMapPowerUps: the map's custom power-ups (PWUP chunk). | |
| static ULONG | bbmapstartpos_c (void) |
| BBMapStartPos: the map's start positions (STRT chunk). | |
| static ULONG | bbmapdata_c (void) |
| BBMapData: the map data (MDAT chunk). | |
| static ULONG | bbmapname_c (void) |
| BBMapName$: the name of the map (NAME chunk), at a3 like BBScenarioName. | |
| static ULONG | bbmappumask_c (void) |
| BBMapPUMask: the map's power-up mask (PWMK chunk). | |
| static ULONG | bbmapdboverlay_c (void) |
| BBMapDBOverLay: the map's destructible block overlay (DBOL chunk). | |
| static ULONG | bbmaponeplayerinfo_c (void) |
| BBMapOnePlayerInfo: the map's one player data (1PLY chunk). | |
| static ULONG | bbmapobjects_c (void) |
| BBMapObjects: the map's one player objects (OBJS chunk). | |
| static void | shadowchk_c (ULONG set) |
| The error check of BBShadowValue (debugger only). | |
Variables | |
| static UBYTE * | maploc |
| static UBYTE * | mapend |
| static struct mfrm * | mfrmchunk |
| static UBYTE * | scenarioloc |
| static UBYTE * | scenarioend |
| static ULONG | lastchunk |
| static ULONG | lastmapchunk |
| static UBYTE * | lastchunkaddr |
| static UBYTE * | lastmapchunkaddr |
| #define LONGAT | ( | p | ) |
| #define WORDAT | ( | p | ) |
| void _bbdestructloc | ( | void | ) |
| void _bbgetpalette | ( | void | ) |
| void _bbmapdata | ( | void | ) |
| void _bbmapdboverlay | ( | void | ) |
| void _bbmapheight | ( | void | ) |
| void _bbmapinfo | ( | void | ) |
| void _bbmapname | ( | void | ) |
| void _bbmapobjects | ( | void | ) |
| void _bbmaponeplayerinfo | ( | void | ) |
| void _bbmappowerups | ( | void | ) |
| void _bbmappumask | ( | void | ) |
| void _bbmapscenarioid | ( | void | ) |
| void _bbmapstartpos | ( | void | ) |
| void _bbmapwidth | ( | void | ) |
| void _bbnumbackground | ( | void | ) |
| void _bbnumbaddies | ( | void | ) |
| void _bbnumdestruct | ( | void | ) |
| void _bbnumindestruct | ( | void | ) |
| void _bbnumtunnels | ( | void | ) |
| void _bbscenarioauthor | ( | void | ) |
| void _bbscenariobaddies | ( | void | ) |
| void _bbscenariodepth | ( | void | ) |
| void _bbscenariohighcol | ( | void | ) |
| void _bbscenariolevel | ( | void | ) |
| void _bbscenariolowcol | ( | void | ) |
| void _bbscenarioname | ( | void | ) |
| void _bbscenariopalette | ( | void | ) |
| void _bbscenarioprefix | ( | void | ) |
| void _bbscenarioshapes | ( | void | ) |
| void _bbscenariosounds | ( | void | ) |
| void _bbshadowvalue | ( | void | ) |
| void _bbtunnelholes | ( | void | ) |
| void _bbtunnelsloc | ( | void | ) |
| void _setbbmaploc | ( | void | ) |
| void _setbbscenarioloc | ( | void | ) |
|
static |
BBDestructLoc: the data of the DEST chunk.
|
static |
BBGetPalette palette#: the colours of the COLR chunk into a palette object.
The colours low..high (bytes r,g,b, each made a long $xxxxxxxx) at the object's colour low; a new colour block (the old colours copied, the old block freed with the size count*12) if high >= the colour count. The new block has high+1 colours and that count (fixed, #548: the original set it to high). Nothing without the chunk, nothing when low > high (fixed, #549: the original wrote the colour at low). Only the colours that lie inside the chunk and the file are read: high is cut to the last of them, nothing without one (fixed, #1113: the original read the colours behind the chunk).
| pal | a0: the palette object (palettelib) |
|
static |
BBMapData: the map data (MDAT chunk).
|
static |
BBMapDBOverLay: the map's destructible block overlay (DBOL chunk).
|
static |
BBMapHeight: the height of the map (+6 of its MFRM chunk).
| prev | d0: d0 at the call (its upper word stays) |
|
static |
BBMapInfo: the map's information chunk (the data of MFRM).
|
static |
BBMapName$: the name of the map (NAME chunk), at a3 like BBScenarioName.
|
static |
BBMapObjects: the map's one player objects (OBJS chunk).
|
static |
BBMapOnePlayerInfo: the map's one player data (1PLY chunk).
|
static |
BBMapPowerUps: the map's custom power-ups (PWUP chunk).
|
static |
BBMapPUMask: the map's power-up mask (PWMK chunk).
|
static |
BBMapScenarioID: the scenario id of the map (+0 of its MFRM chunk).
|
static |
BBMapStartPos: the map's start positions (STRT chunk).
|
static |
BBMapWidth: the width of the map (+4 of its MFRM chunk).
| prev | d0: d0 at the call (its upper word stays) |
|
static |
BBNumBackGround: the word at +0 of the SHAP chunk.
|
static |
BBNumBaddies: the byte at +0 of the BAD! chunk.
|
static |
BBNumDestruct: the word at +2 of the SHAP chunk.
|
static |
BBNumIndestruct: the word at +4 of the SHAP chunk.
|
static |
BBNumTunnels: the word at +0 of the TUNL chunk.
|
static |
BBScenarioAuthor: the author in the ANNO chunk (the string behind the name's 0, at an even address), at a3 like BBScenarioName.
|
static |
BBScenarioBaddiesLoc: the data of the BAD! chunk from +2 on.
|
static |
BBScenarioDepth: the word of the DEPF chunk.
|
static |
BBScenarioHighCol: the last colour of the COLR chunk (its byte 1).
Fixed (#550): the byte unsigned (the original: EXT.w).
|
static |
BBScenarioLevel: the word of the LEVL chunk.
|
static |
BBScenarioLowCol: the first colour of the COLR chunk (its byte 0).
Fixed (#550): the byte unsigned (the original: EXT.w).
|
static |
BBScenarioName: the name in the ANNO chunk, at a3 (without its 0, a3 behind the last character).
|
static |
BBScenarioPalette: the colours of the COLR chunk (behind its low and high byte).
|
static |
BBScenarioPrefix: the long of the PRFX chunk.
|
static |
BBScenarioShapeLoc: the data of the GFX! chunk.
|
static |
BBScenarioSounds: the data of the SFX! chunk.
|
static |
BBShadowValue shadowset: the long number set of the SHDW chunk (ASL.w #2: a word index).
A set outside the chunk is read unchecked (an invalid argument); with runtime error checking shadowchk refuses it (fixed, #1114).
| set | d0: the shadow set |
|
static |
BBTunnelHoles: the long at +2 of the TUNL chunk.
|
static |
BBTunnelsLoc: the data of the TUNL chunk from +8 on.
|
static |
|
static |
|
static |
finit: does nothing (RTS).
|
static |
init: no map, no scenario, nothing cached.
Fixed (#1108): the original's init is an RTS, so a second run of a program with the library still loaded (from the editor) started with the files and caches of the run before.
|
static |
|
static |
|
static |
| FN0 | ( | BL_LONG | , |
| _bbdestructloc | , | ||
| "BBDestructLoc" | , | ||
| "" | ) |
| FN0 | ( | BL_LONG | , |
| _bbmapdata | , | ||
| "BBMapData" | , | ||
| "- returns location of actual map data" | ) |
| FN0 | ( | BL_LONG | , |
| _bbmapdboverlay | , | ||
| "BBMapDBOverLay" | , | ||
| "- returns map destructible block overlay (or zero for none)" | ) |
| FN0 | ( | BL_LONG | , |
| _bbmapinfo | , | ||
| "BBMapInfo" | , | ||
| "- returns map information chunk" | ) |
| FN0 | ( | BL_LONG | , |
| _bbmapobjects | , | ||
| "BBMapObjects" | , | ||
| "- returns one player object chunk (or zero for none)" | ) |
| FN0 | ( | BL_LONG | , |
| _bbmaponeplayerinfo | , | ||
| "BBMapOnePlayerInfo" | , | ||
| "- returns one player data chunk (or zero for none)" | ) |
| FN0 | ( | BL_LONG | , |
| _bbmappowerups | , | ||
| "BBMapPowerUps" | , | ||
| "- returns location of custom powerups" | ) |
| FN0 | ( | BL_LONG | , |
| _bbmappumask | , | ||
| "BBMapPUMask" | , | ||
| "- returns map powerup mask (or zero for none)" | ) |
| FN0 | ( | BL_LONG | , |
| _bbmapscenarioid | , | ||
| "BBMapScenarioID" | , | ||
| "- returns scenarios of map" | ) |
| FN0 | ( | BL_LONG | , |
| _bbmapstartpos | , | ||
| "BBMapStartPos" | , | ||
| "- returns location of start position data" | ) |
| FN0 | ( | BL_LONG | , |
| _bbscenariobaddies | , | ||
| "BBScenarioBaddiesLoc" | , | ||
| "" | ) |
| FN0 | ( | BL_LONG | , |
| _bbscenariopalette | , | ||
| "BBScenarioPalette" | , | ||
| "" | ) |
| FN0 | ( | BL_LONG | , |
| _bbscenarioprefix | , | ||
| "BBScenarioPrefix" | , | ||
| "" | ) |
| FN0 | ( | BL_LONG | , |
| _bbscenarioshapes | , | ||
| "BBScenarioShapeLoc" | , | ||
| "" | ) |
| FN0 | ( | BL_LONG | , |
| _bbscenariosounds | , | ||
| "BBScenarioSounds" | , | ||
| "" | ) |
| FN0 | ( | BL_LONG | , |
| _bbtunnelholes | , | ||
| "BBTunnelHoles" | , | ||
| "" | ) |
| FN0 | ( | BL_LONG | , |
| _bbtunnelsloc | , | ||
| "BBTunnelsLoc" | , | ||
| "" | ) |
| FN0 | ( | BL_STRING | , |
| _bbmapname | , | ||
| "BBMapName$" | , | ||
| "- returns the name of the map" | ) |
| FN0 | ( | BL_STRING | , |
| _bbscenarioauthor | , | ||
| "BBScenarioAuthor" | , | ||
| "" | ) |
| FN0 | ( | BL_STRING | , |
| _bbscenarioname | , | ||
| "BBScenarioName" | , | ||
| "" | ) |
| FN0 | ( | BL_WORD | , |
| _bbmapheight | , | ||
| "BBMapHeight" | , | ||
| "- returns map height" | ) |
| FN0 | ( | BL_WORD | , |
| _bbmapwidth | , | ||
| "BBMapWidth" | , | ||
| "- returns map width" | ) |
| FN0 | ( | BL_WORD | , |
| _bbnumbackground | , | ||
| "BBNumBackGround" | , | ||
| "" | ) |
| FN0 | ( | BL_WORD | , |
| _bbnumbaddies | , | ||
| "BBNumBaddies" | , | ||
| "- returns number of baddies" | ) |
| FN0 | ( | BL_WORD | , |
| _bbnumdestruct | , | ||
| "BBNumDestruct" | , | ||
| "" | ) |
| FN0 | ( | BL_WORD | , |
| _bbnumindestruct | , | ||
| "BBNumIndestruct" | , | ||
| "" | ) |
| FN0 | ( | BL_WORD | , |
| _bbnumtunnels | , | ||
| "BBNumTunnels" | , | ||
| "" | ) |
| FN0 | ( | BL_WORD | , |
| _bbscenariodepth | , | ||
| "BBScenarioDepth" | , | ||
| "" | ) |
| FN0 | ( | BL_WORD | , |
| _bbscenariohighcol | , | ||
| "BBScenarioHighCol" | , | ||
| "" | ) |
| FN0 | ( | BL_WORD | , |
| _bbscenariolevel | , | ||
| "BBScenarioLevel" | , | ||
| "" | ) |
| FN0 | ( | BL_WORD | , |
| _bbscenariolowcol | , | ||
| "BBScenarioLowCol" | , | ||
| "" | ) |
|
static |
|
static |
SetBBMapLoc address: the map file ("FORM" .. "BMAP") in memory for the BBMap... functions; finds its MFRM chunk.
A failed call keeps the old map, its info chunk and its cache (fixed, #554: the original stored the address before the checks). Without MFRM there is no info chunk (fixed, #551: the original took the address behind the last chunk id read); the call still succeeds.
| form | d0: the address of the file |
SetBBScenarioLoc address: the scenario file ("FORM" .. "SCEN") in memory for the BBScenario.../BBNum.../BBTunnel... functions.
A failed call keeps the old file and its cache (original behaviour).
| form | d0: the address of the file |
| void shadowchk | ( | void | ) |
|
static |
The error check of BBShadowValue (debugger only).
Fixed (#1114), not in the original (ribbmaplib had no error check area): the set indexes the SHDW chunk without a check. A set is refused when it is negative, $2000 or more (its word index wraps) or not below the chunk's length / 4 (the length cut at the file's end). Without a scenario or a SHDW chunk nothing is checked (BBShadowValue gives 0). The search runs on copies of the cache: the check changes nothing. The release code is unchanged (an invalid argument).
Errors: "Shadow set must lie in the SHDW chunk".
| set | d0: the shadow set (word) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |