summaryrefslogtreecommitdiff
path: root/platformer/src/world.c
diff options
context:
space:
mode:
authorSchark <jordan@schark.online>2026-09-23 23:40:11 -0400
committerSchark <jordan@schark.online>2026-09-23 23:40:11 -0400
commit23ef8bc20310bdfad52b07a3f1e4e61c98896841 (patch)
tree007cc1d6d73ebb38d2e06422d4050f769dd65535 /platformer/src/world.c
parentdab65412376d1b73381446f969c1461c24169811 (diff)
downloadgamedev-23ef8bc20310bdfad52b07a3f1e4e61c98896841.tar.gz
gamedev-23ef8bc20310bdfad52b07a3f1e4e61c98896841.zip
Working demogit add README.md src/
Diffstat (limited to '')
-rw-r--r--platformer/src/world.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/platformer/src/world.c b/platformer/src/world.c
index 2dffb72..4ae0d00 100644
--- a/platformer/src/world.c
+++ b/platformer/src/world.c
@@ -27,3 +27,38 @@
* DONE WHEN: It compiles warning-free, and the player can't leave the square.
* ============================================================
*/
+
+#include "config.h"
+#include "world.h"
+
+void world_init(void)
+{
+ /* Nothing to do yet. This is where level data would be loaded. */
+}
+
+float world_ground_height(float x, float z)
+{
+ /* The world is flat for now. This is where a heightmap/platform lookup
+ * will go once there's terrain to stand on. */
+ (void)x;
+ (void)z;
+ return 0.0f;
+}
+
+/* Keeps x and z on the ground square; y (height) is untouched. */
+Vec3 world_clamp_to_bounds(Vec3 p)
+{
+ p.x = clampf(p.x, -WORLD_HALF_EXTENT, WORLD_HALF_EXTENT);
+ p.z = clampf(p.z, -WORLD_HALF_EXTENT, WORLD_HALF_EXTENT);
+ return p;
+}
+
+Vec3 world_spawn_point(void)
+{
+ return vec3_make(0.0f, 0.0f, 0.0f);
+}
+
+float world_half_extent(void)
+{
+ return WORLD_HALF_EXTENT;
+}