Nimbin[12]?Games / Entropie / entropie/src/world/field.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/field.h 3 KB · 63 lines raw
#ifndef WORLD_FIELD_H
#define WORLD_FIELD_H

/*
 * The side jobs on the ground (see the story, roadmap 4):
 *
 * - The Kartoffelacker's grass: knee high, mown with the scythe (the ground
 *   is too uneven for a mower). The field is cut into cells
 *   (World.mown: 0 standing .. FIELD_MOWN mown, FIELD_OFF not to be mown:
 *   under the stage); each swing over a cell takes it a step down.
 * - The vineyard snails (OBJ_SNAIL, protected): in the field and round the
 *   Obstwiese. Picked up into a bucket (Object.snails) and let go at the
 *   refuge by the strip of wood; mown over, a snail is dead. The regulatory
 *   office comes at FIELD_INSPECTION hours on the ground (game_story.c).
 * - Kerry's wood art: a log lying at the art spot, carved with the chainsaw
 *   into a figure (OBJ_SCULPTURE).
 */

#include "world/world.h"

#define FIELD_X0     -25.6f /* the mown area, on the ground (world x, z) ... */
#define FIELD_Z0      89.5f
#define FIELD_CELL    1.0f  /* ... in cells this wide */
#define FIELD_NX      20
#define FIELD_NZ      26
#define FIELD_CELLS   (FIELD_NX * FIELD_NZ)
#define FIELD_MOWN    3     /* swings over a cell till it's mown */
#define FIELD_OFF     255   /* (not to be mown) */
#define FIELD_SNAILS  30    /* snails in the field ... */
#define ORCHARD_SNAILS 10   /* ... and round the Obstwiese */
#define SNAIL_BUCKET  8     /* in one bucket at most */
#define FIELD_INSPECTION 44.0f /* hours on the ground: the regulatory office comes */
#define ART_REACH     5.0f  /* m round the art spot: a log here is Kerry's */
#define CARVE_NEED    2.5f  /* person-hours to carve a log into a figure */

/* Is (x, z) in the field, and how far is it mown there (0..1)? */
bool  Field_inside(float x, float z);
float Field_mownAt(const World *world, float x, float z);
/* A swing of the scythe: cells within radius of at a step further mown. Returns how many got
   mown just now; snails there are dead (*killed, may be NULL). */
int   Field_mow(World *world, Vec3 at, float radius, int *killed);
/* 0..1 how much of it is mown. */
float Field_done(const World *world);
/* The nearest cell still to be mown (its middle on the ground), false: all mown. */
bool  Field_nextUnmown(const World *world, Vec3 from, Vec3 *out);
/* At the start: the cells under the stage left out, the snails put out. */
bool  Field_prepare(World *world);

/* Snails still out where the building goes (not rescued, alive). */
int   Field_snailsLeft(const World *world);
/* ... of them in the Kartoffelacker's grass. */
int   Field_snailsInField(const World *world);
/* who is at the refuge with snails in the bucket: let go there. Returns how many. */
int   Field_release(World *world, Object *who);
/* Picked up: into who's bucket (false: full). */
bool  Field_pickSnail(World *world, Object *who, Object *snail);

/* Kerry's art: a log lying at the art spot (not yet carved), or NULL; and done: the log a figure. */
Object *Field_artLog(const World *world);
Object *Field_carve(World *world, Object *log);
int     Field_artPieces(const World *world);

#endif /* WORLD_FIELD_H */