texture headers Each direction points to a readable `.xpm` file.
The parser requires six configuration headers before the map can be accepted: four wall textures and two RGB colors.
Configuration headers
The parser validates four wall texture paths and two RGB color entries before map storage and runtime rendering can continue.
texture headers Each direction points to a readable `.xpm` file.
color headers Floor and ceiling colors must use strict `r,g,b` syntax.
parse_texture(app, id, value) Texture validation resolves absolute or `.cub`-relative paths before later MLX loading.
if (slot != NULL)
return error("duplicate");
value = trim(line after identifier);
resolved = resolve_from_map_dir_or_absolute(value);
if (!resolved && ends_with(value, ".xpm"))
return error("unreadable");
if (!resolved)
return error("not .xpm");
*slot = resolved; parse_color(app, id, value) RGB values are parsed in place with strict separators and stored as three integers.
skip spaces;
for k in 0..2:
parse decimal digits
if missing digits:
return error("not numeric");
if (v < 0 || v > 255)
return error("out of range");
require comma for first two values
reject trailing non-space content; validation points Each failure exits before MLX runtime rendering starts.
slot already set / rgb != -1 check_required_headers(app) ends_with(".xpm") open(path) < 0 strict parse_rgb_triplet() ft_isdigit(line[i]) v < 0 || v > 255 relative to .cub directory interactive header validator Try texture and RGB values against the same documented parser rules.
check_required_headers(app) Startup continues only when the four texture slots and both RGB triplets are present and valid.
After success, texture paths are owned by `app` and MLX loads the `.xpm` images during initialization.
Texture headers:
NO for north wall textureSO for south wall textureWE for west wall textureEA for east wall textureColor headers:
F for floor colorC for ceiling colorTexture values must be non-empty readable .xpm paths. Relative texture paths
are normalized from the .cub file directory so maps can be launched from
different working directories.
Color values must use strict r,g,b syntax, with exactly three numeric
components and each component in [0..255].
Duplicate headers, missing headers, unreadable texture files, invalid texture
extensions, malformed RGB syntax, and out-of-range RGB values all abort startup
through the normal Error\n... path before rendering begins.