pt2game/compiled_structures.h

43 lines
1.2 KiB
C
Raw Normal View History

#ifndef COMPILED_STRUCTURES_H_
#define COMPILED_STRUCTURES_H_
struct navmesh_point {
int x, y;
};
struct navmesh_tri_edge {
float a,b,c; // line equation a*x + b*y + c > 0 if point is in polygon, and value gives distance from line.
int other_tri; // -1 if this edge is a border of navmesh, else polygon it connects to
struct navmesh_point center; // intermediate point for use in routing. could be improved later.
};
struct navmesh_tri {
int num_verts;
const struct navmesh_tri_edge *edges;
const struct navmesh_point *points;
// For a triangle:
// edges[0]: points[0]-points[1]
// edges[1]: points[1]-points[2]
// edges[2]: points[2]-points[0]
};
struct navmesh {
int num_tris;
const struct navmesh_tri *tris;
const unsigned char *pathfindgrid; // [dest*num_tris + source] gives index of next tri. Placeholder value is used when dest==source.
};
struct level_clickregion_edge {
float a,b,c; // line equation a*x + b*y + c > 0 if point is in polygon
};
struct level_clickregion {
int id;
int x, y, width, height;
int num_edges;
const struct level_clickregion_edge *edges;
};
struct level_predef_data {
const struct level_clickregion *clickregions; // terminated by null entry
};
#endif /* COMPILED_STRUCTURES_H_ */