diff options
| author | Schark <jordan@schark.online> | 2026-09-29 22:28:37 -0400 |
|---|---|---|
| committer | Schark <jordan@schark.online> | 2026-09-29 22:28:37 -0400 |
| commit | fdc8c951fc72d9dc4c8faa58a21b2b9de0599698 (patch) | |
| tree | edd9934a43429508acb9ec37da71eb172dc788e9 /platformer/src/level.c | |
| parent | adb6a882870464490a8026aed1f66b21b0e72477 (diff) | |
| download | gamedev-fdc8c951fc72d9dc4c8faa58a21b2b9de0599698.tar.gz gamedev-fdc8c951fc72d9dc4c8faa58a21b2b9de0599698.zip | |
Implemented no-panning zones
Diffstat (limited to 'platformer/src/level.c')
| -rw-r--r-- | platformer/src/level.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/platformer/src/level.c b/platformer/src/level.c index 12a0862..3ae45be 100644 --- a/platformer/src/level.c +++ b/platformer/src/level.c @@ -89,6 +89,11 @@ * choice ("how do I get up there?") instead of one correct jump after * another, and the route makes sure a way up always exists. * + * - level_build_zones(): TEST_ZONES, hand-placed. One locked-pan zone covers the + * whole cliff and its climb band (south and east faces, out to where the + * climb platforms reach), from the ground up to exactly CLIFF_TOP, so the + * camera stops swinging behind the player while they climb and swings + * again once they stand on the summit. * - level_motion_offset(m, time): see level.h. * - level_spawn_point(): (0, 0, 0). * @@ -895,6 +900,18 @@ static void add_crossing(void) } } +/* ---- Zones ------------------------------------------------------------- */ + +/* Non-solid regions (see world.h). Bounds: min corner, max corner; the Box's + * wall-hang and style fields mean nothing for a zone. */ +static const Zone TEST_ZONES[] = { + /* One box round the whole cliff: from the climb's start west of the south + * face, out ~20 m past both faces, to past the east face's north end, up + * to exactly the top. It also takes in some of the river, which is fine. */ + { { { -42.0f, 0.0f, 21.0f }, { 40.0f, CLIFF_TOP, 94.0f }, false, BOX_STYLE_PLATFORM }, ZONE_LOCKED_PAN }, +}; +#define TEST_ZONE_COUNT ((int)(sizeof TEST_ZONES / sizeof TEST_ZONES[0])) + /* ---- Public interface -------------------------------------------------- */ int level_build(LevelBox *out, int capacity) @@ -918,6 +935,14 @@ int level_build(LevelBox *out, int capacity) return s_count; } +int level_build_zones(Zone *out, int capacity) +{ + int count = 0; + for (int i = 0; i < TEST_ZONE_COUNT && count < capacity; i++) + out[count++] = TEST_ZONES[i]; + return count; +} + Vec3 level_motion_offset(BoxMotion m, float time) { float angle = 2.0f * M3D_PI * (time / m.period + m.phase); |
