2025-02-18 01:04:17 +00:00
|
|
|
#ifndef COMPILED_STRUCTURES_H_
|
|
|
|
#define COMPILED_STRUCTURES_H_
|
|
|
|
|
|
|
|
|
|
|
|
struct navmesh_point {
|
|
|
|
int x, y;
|
|
|
|
};
|
|
|
|
struct navmesh_tri_edge {
|
2025-02-18 22:11:20 +00:00
|
|
|
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
|
2025-02-18 01:04:17 +00:00
|
|
|
struct navmesh_point center; // intermediate point for use in routing. could be improved later.
|
|
|
|
};
|
|
|
|
struct navmesh_tri {
|
2025-02-18 16:22:39 +00:00
|
|
|
int num_verts;
|
|
|
|
const struct navmesh_tri_edge *edges;
|
|
|
|
const struct navmesh_point *points;
|
|
|
|
// For a triangle:
|
2025-02-18 01:04:17 +00:00
|
|
|
// 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.
|
|
|
|
};
|
|
|
|
|
2025-02-18 22:11:20 +00:00
|
|
|
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;
|
2025-02-19 00:55:56 +00:00
|
|
|
int x, y, width, height;
|
2025-02-18 22:11:20 +00:00
|
|
|
int num_edges;
|
|
|
|
const struct level_clickregion_edge *edges;
|
|
|
|
};
|
2025-02-19 16:21:26 +00:00
|
|
|
struct level_predef_point {
|
|
|
|
int x, y;
|
|
|
|
int id;
|
|
|
|
};
|
2025-02-18 22:11:20 +00:00
|
|
|
struct level_predef_data {
|
|
|
|
const struct level_clickregion *clickregions; // terminated by null entry
|
2025-02-19 16:21:26 +00:00
|
|
|
const struct level_predef_point *points; // terminated by x=0 y=0
|
2025-02-19 18:09:13 +00:00
|
|
|
const struct navmesh *navmesh;
|
|
|
|
const unsigned char *background;
|
|
|
|
int bgwidth, bgheight;
|
2025-02-18 22:11:20 +00:00
|
|
|
};
|
|
|
|
|
2025-02-18 01:04:17 +00:00
|
|
|
|
|
|
|
#endif /* COMPILED_STRUCTURES_H_ */
|