X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Flevel.h;h=dc9af8d29ef92dc04141967011b95896e2bd7c4a;hb=7aad8db2edab014c0f750de76bc24bdab63aef2a;hp=0bcf5787e179a0839bef34926690972019492599;hpb=41765ea063cbab26ae05e7259ffc8a7c85db2f5d;p=gbajam22 diff --git a/src/level.h b/src/level.h index 0bcf578..dc9af8d 100644 --- a/src/level.h +++ b/src/level.h @@ -3,6 +3,9 @@ #include +/* cell size in 16.16 fixed point */ +#define CELL_SIZE 0x20000 + enum { MOBS_DEAD, MOBS_IDLE, MOBS_ENGAGE, MOBS_RUN }; struct mob { @@ -28,22 +31,36 @@ enum { CELL_SOLID, CELL_WALK }; struct cell { uint8_t type; uint8_t x, y; - uint8_t pad; + uint8_t rank; struct mob *mobs; struct item *items; }; struct level { int width, height; + int orgx, orgy; unsigned int xmask; + int xshift; struct cell *cells; struct mob *mobs; struct item *items; + + /* populated by calc_vis */ + struct cell *vis[128]; + int numvis; }; +struct player; struct level *init_level(const char *descstr); void free_level(struct level *lvl); +struct cell *level_cell(struct level *lvl, int cx, int cy); + +void upd_vis(struct level *lvl, struct player *p); + +void cell_to_pos(struct level *lvl, int cx, int cy, int32_t *px, int32_t *py); +void pos_to_cell(struct level *lvl, int32_t px, int32_t py, int *cx, int *cy); + #endif /* LEVEL_H_ */