Nimbin[12]?Games / Entropie / entropie/src/world/nav.h

Entropie git · main

Entropie festival game; first steps

sdl c game entropie cmake · first commit 2026-10-10 · last commit 2026-11-02 (18 hours ago) · synced 10 hours ago

C 88.5% Markdown 9.1% GLSL 2.3%
git clone https://git.christianimmanuel.de/games/Entropie.gitwget https://git.christianimmanuel.de/games/Entropie/archive/Entropie.tar.gz
entropie/src/world/nav.h 1 KB · 32 lines raw
#ifndef WORLD_NAV_H
#define WORLD_NAV_H

/*
 * A coarse walking map of the site: which spots a person can't stand on
 * because something fixed is in the way (walls, trees, bushes, cars,
 * furniture). Used to find a way round when walking straight at something
 * leads into a corner. Rebuilt by itself when fixed things change.
 */

#include <stdbool.h>

#include "world/object.h"
#include "world/terrain.h"

#define NAV_CELL      0.4f   /* meters per cell */
#define NAV_PATH_MAX  24     /* waypoints in one way */

/* Rebuilds the map when fixed things were added, removed or moved. */
void Nav_update(Object *const *objects, int count, const Terrain *terrain);

/* Can a person stand here (as far as fixed things go)? */
bool Nav_free(Vec3 p);

/*
 * A way from `from` to `to` round fixed things: waypoints after the start,
 * the last one at `to` (or the nearest free spot by it). Returns how many
 * (0: no way, or the map isn't built).
 */
int Nav_findPath(Vec3 from, Vec3 to, Vec3 *out, int max);

#endif /* WORLD_NAV_H */