Nuclide
Software Development Kit for id Tech
maplibrary.h File Reference

Map library parsing and querying of metadata. More...

Go to the source code of this file.

Enumerations

enum  mapType_t {
  MAPINFO_NAME , MAPINFO_TITLE , MAPINFO_AUTHOR , MAPINFO_TYPE ,
  MAPINFO_PREVIEW
}
 

Functions

void MapLibrary_Init (void)
 Initialize the map library, MapLibrary_GetMapCount() will return the amount of maps available. More...
 
int MapLibrary_GetMapCount (void)
 Returns the total amount of maps available. More...
 
__variant MapLibrary_GetInfo (int, mapType_t)
 Retrieve information about a given mapID. More...
 

Detailed Description

Map library parsing and querying of metadata.

Menus need to be aware of what levels aka maps are available for modes like multiplayer. The MapLibrary is by configured to only parse levels from the current game directory (much like GoldSrc) and optionally can blacklist maps based on a variety of criteria which may be configurable at some point in time.

The menu needs to call MapLibrary_Init() at least once, after which you can query the total amount of maps that are available via MapLibrary_GetMapCount().

You can then iterate over the individual entries with MapLibrary_GetInfo().

Enumeration Type Documentation

◆ mapType_t

enum mapType_t
Enumerator
MAPINFO_NAME 

(string) Name of the map.

E.g. e1m1

MAPINFO_TITLE 

(string) Title of the map.

E.g. "Abyss of Cake"

MAPINFO_AUTHOR 

(string) Author of the map.

E.g. "John Doe"

MAPINFO_TYPE 

(string) Type of map.

MAPINFO_PREVIEW 

(string) URL to a preview of the map.

NULL if not available. Will look for level previews inside levelshots/ and maps/ with any file extensions supported by the engine and whitelisted within the cvar 'r_imageextensions'.

Function Documentation

◆ MapLibrary_GetInfo()

__variant MapLibrary_GetInfo ( int  mapID,
mapType_t  infoType 
)

Retrieve information about a given mapID.

See mapType_t for which fields you can query.

◆ MapLibrary_GetMapCount()

int MapLibrary_GetMapCount ( void  )

Returns the total amount of maps available.

◆ MapLibrary_Init()

void MapLibrary_Init ( void  )

Initialize the map library, MapLibrary_GetMapCount() will return the amount of maps available.