labyrinth
annotate src/level.h @ 1:d46f0947a96d
added helpful comment
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Fri, 06 Feb 2015 00:34:04 +0200 |
parents | |
children |
rev | line source |
---|---|
nuclear@0 | 1 #ifndef LEVEL_H_ |
nuclear@0 | 2 #define LEVEL_H_ |
nuclear@0 | 3 |
nuclear@0 | 4 #define MAX_LEVEL_SIZE 64 |
nuclear@0 | 5 |
nuclear@0 | 6 struct level { |
nuclear@0 | 7 int cells[MAX_LEVEL_SIZE][MAX_LEVEL_SIZE]; |
nuclear@0 | 8 int num_cells[2]; |
nuclear@0 | 9 float cell_size; /* in meters */ |
nuclear@0 | 10 float cell_height; /* in meters */ |
nuclear@0 | 11 int start_pos[2]; |
nuclear@0 | 12 |
nuclear@0 | 13 float goal_pos[2]; |
nuclear@0 | 14 |
nuclear@0 | 15 unsigned int floor_tex, wall_tex, ceil_tex; |
nuclear@0 | 16 float floor_tex_scale, wall_tex_scale, ceil_tex_scale; |
nuclear@0 | 17 }; |
nuclear@0 | 18 |
nuclear@0 | 19 void level_init(struct level *lvl); |
nuclear@0 | 20 int level_load(struct level *lvl, const char *fname); |
nuclear@0 | 21 |
nuclear@0 | 22 /* convert from cell coords to world space pos and back */ |
nuclear@0 | 23 void level_pos_to_cell(struct level *lvl, float x, float y, int *res_cx, int *res_cy); |
nuclear@0 | 24 void level_cell_to_pos(struct level *lvl, int cx, int cy, float *resx, float *resy); |
nuclear@0 | 25 |
nuclear@0 | 26 int level_cell(struct level *lvl, int cx, int cy); |
nuclear@0 | 27 int level_cell_at(struct level *lvl, float x, float y); |
nuclear@0 | 28 |
nuclear@0 | 29 int level_obj_pos(struct level *lvl, int objname, float *resx, float *resy); |
nuclear@0 | 30 |
nuclear@0 | 31 /* direction parameters are in-out */ |
nuclear@0 | 32 int level_collide(struct level *lvl, float rad, float x, float y, float *dx, float *dy); |
nuclear@0 | 33 |
nuclear@0 | 34 void level_draw(struct level *lvl); |
nuclear@0 | 35 |
nuclear@0 | 36 #endif /* LEVEL_H_ */ |