Nimbin[12]?Games / Entropie / entropie/src/world/camp.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/camp.h 4 KB · 91 lines raw
#ifndef WORLD_CAMP_H
#define WORLD_CAMP_H

/*
 * The fireplace, and cleaning up.
 *
 * Wood lying in a fireplace is its fuel. Lit, the fire burns it down piece by
 * piece and goes out when nothing is left. The more wood, the bigger the fire,
 * and the more water (or pee) it takes to put it out. Food held close to a burning fire,
 * or lying on its grill, gets done, then darker, then burnt. People like to sit
 * (squat) round a burning fire.
 *
 * Trash goes into a garbage bag held in one hand, a piece at a time; bags and
 * loose trash go into the waste container.
 */

#include <stdbool.h>

#include "world/object.h"

#define FIRE_SIT_DISTANCE 2.0f  /* people sit this far from the middle of a fire */

/* Burns the fires down and grills food held over them. Returns a piece of food
   that just got done (or NULL). */
Object *Camp_update(Object *const *objects, int count, float dt, float game_dt);

/* Nearest fireplace within range (only burning ones if asked). */
Object *Camp_fireNear(Object *const *objects, int count, Vec3 pos, float range, bool burning_only);

/* A static thing of this type right in front of who (fireplace, container). */
Object *Camp_inFront(const Object *who, Object *const *objects, int count, ObjectType type);

enum { FED_NOTHING, FED_WOOD, FED_GRILL };
/* Puts the wood in who's hands into the fire, or food on the grill. */
int     Camp_feed(Object *who, Object *fire);

/* Lights the fire if there is wood in it. */
bool    Camp_light(Object *fire);

/* Trash right in front of who, within reach. */
Object *Camp_trashInFront(const Object *who, Object *const *objects, int count);

/* The garbage bag in who's hands, or NULL. */
Object *Camp_bagInHand(const Object *who);

/* Puts trash into the bag. False if the bag is full. */
bool    Camp_bag(Object *bag, Object *trash);

/* The food on this fire's grill that has been on longest (most done), or NULL. */
Object *Camp_onGrill(Object *const *objects, int count, const Object *fire);
/* Takes that off the grill into a free hand; NULL if nothing there (or no free hand). */
Object *Camp_takeOff(Object *who, Object *fire, Object *const *objects, int count);

enum { POURED_NOTHING, POURED_HISS, POURED_OUT, POURED_FLARE };
/* Pours what's left in the bottle onto a burning fire: water or beer helps
   (a small fire goes out), vodka flares up. */
int     Camp_pourOnFire(Object *fire, Object *bottle);

/* Pours a drink over someone burning (bottle empties). False if no drink or not burning. */
bool    Camp_douse(Object *target, Object *bottle);

/* Throws the trash and bags in who's hands away. Returns pieces of trash gone. */
int     Camp_throwAway(Object *who);

/* What becomes of an empty bottle in this hand (roll: 0..1, chance): into the
   container if one is right there; stood on a table or crate in reach, or with
   other empties standing about; else put down at the feet, or (careless,
   drunk, wild) tossed away. Says what happened. */
typedef enum { DONE_NONE, DONE_BIN, DONE_PLACED, DONE_WITH_OTHERS, DONE_DOWN, DONE_TOSSED } DoneWith;
DoneWith Camp_doneWithBottle(Object *who, int hand, Object *const *objects, int count, float roll);

/* Water landing at point (hose, watering can): puddles wash away, people
   get clean (and wet), burning people and fires go out. by: who's watering. */
void    Camp_water(Object *const *objects, int count, const Object *by, Vec3 point, float liters, float dt);

/* Pee landing at point: puts out burning people and (small) fires too. */
void    Camp_pee(Object *const *objects, int count, const Object *by, Vec3 point, float liters, float dt);

/* Liters it takes to put this fire out (more wood: more water). */
float   Camp_waterNeeded(const Object *fire);

/* How big the flames are (1 = a normal fire), from the wood and the water on it. */
float   Camp_flameSize(const Object *fire);

/* Set when a fire was just put out with water or pee (cleared by whoever reads it). */
extern bool camp_doused;

/* The brightest fire (0 = none) and where it is, for the light it casts. */
float   Camp_firelight(Object *const *objects, int count, Vec3 *where);

#endif /* WORLD_CAMP_H */