nuclear@0: #ifndef LEVEL_H_ nuclear@0: #define LEVEL_H_ nuclear@0: nuclear@0: #define MAX_LEVEL_SIZE 64 nuclear@0: nuclear@0: struct level { nuclear@0: int cells[MAX_LEVEL_SIZE][MAX_LEVEL_SIZE]; nuclear@0: int num_cells[2]; nuclear@0: float cell_size; /* in meters */ nuclear@0: float cell_height; /* in meters */ nuclear@0: int start_pos[2]; nuclear@0: nuclear@0: float goal_pos[2]; nuclear@0: nuclear@0: unsigned int floor_tex, wall_tex, ceil_tex; nuclear@0: float floor_tex_scale, wall_tex_scale, ceil_tex_scale; nuclear@0: }; nuclear@0: nuclear@0: void level_init(struct level *lvl); nuclear@0: int level_load(struct level *lvl, const char *fname); nuclear@0: nuclear@0: /* convert from cell coords to world space pos and back */ nuclear@0: void level_pos_to_cell(struct level *lvl, float x, float y, int *res_cx, int *res_cy); nuclear@0: void level_cell_to_pos(struct level *lvl, int cx, int cy, float *resx, float *resy); nuclear@0: nuclear@0: int level_cell(struct level *lvl, int cx, int cy); nuclear@0: int level_cell_at(struct level *lvl, float x, float y); nuclear@0: nuclear@0: int level_obj_pos(struct level *lvl, int objname, float *resx, float *resy); nuclear@0: nuclear@0: /* direction parameters are in-out */ nuclear@0: int level_collide(struct level *lvl, float rad, float x, float y, float *dx, float *dy); nuclear@0: nuclear@0: void level_draw(struct level *lvl); nuclear@0: nuclear@0: #endif /* LEVEL_H_ */