#ifndef GENESIS_BLOBBER_DUNGEON_H
#define GENESIS_BLOBBER_DUNGEON_H

#include <stdint.h>
#include "cell3d.h"

typedef struct {
    int stairs_up_x, stairs_up_y;     /* -1 if not set */
    int stairs_down_x, stairs_down_y; /* -1 if not set */
} b_level_info_t;

typedef struct {
    int n_levels;
    cell3d_t       *cells;   /* contiguous: cells[(lvl*BL_DROWS + y)*BL_DCOLS + x] */
    b_level_info_t *levels;  /* length n_levels */
} dungeon_t;

dungeon_t *dungeon_create(int n_levels);
void       dungeon_destroy(dungeon_t *d);

static inline cell3d_t *dungeon_cell(dungeon_t *d, int lvl, int x, int y) {
    return &d->cells[(lvl * BL_DROWS + y) * BL_DCOLS + x];
}
static inline const cell3d_t *dungeon_cell_c(const dungeon_t *d, int lvl, int x, int y) {
    return &d->cells[(lvl * BL_DROWS + y) * BL_DCOLS + x];
}

#endif
