Entropie git · main
Entropie festival game; first steps
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.gzentropie/src/world/tent.h raw
#ifndef WORLD_TENT_H
#define WORLD_TENT_H
/*
* Tents (OBJ_TENT, variant 0 small, 1 big): spread out from their bag where
* it lies, then pitched in stages - the poles in and up, the cover over it,
* the pegs hammered in - by whoever works on it (several at once: quicker).
* Sleeping bags and mats put down at the door go in; their owners sleep in
* it (in_tent: lying inside, the tent round them).
*/
#include "world/world.h"
typedef enum { TENT_LAID, TENT_POLES, TENT_COVER, TENT_PEGS, TENT_UP } TentStage;
/* A tent bag (OBJ_GEAR) spread out as a tent where it lies, the door facing door_dir: the tent, or NULL. */
Object *Tent_unpack(World *world, Object *bag, Vec3 door_dir);
/* Somebody working on it this frame (both hands free, at it): the next bit
done. Returns the stage it got to when one was finished just now, else -1. */
int Tent_work(Object *tent, Object *who, float dt);
/* Taking a tent down (anybody in it comes out): Tent_work then goes the other
way, returning TENT_DOWN + the stage it's down to (or TENT_DOWN_PACKED: folded
up; Tent_update packs it into its bag, left packed, its beds at the door). */
#define TENT_DOWN 10
#define TENT_DOWN_PACKED 20
void Tent_takeDown(Object *const *objects, int count, Object *tent);
/* No pegs in it (spread out, on its poles, the cover on, the pegs out): it can be moved. */
bool Tent_movable(const Object *tent);
/* Its look and box again for how far it's up (after loading a save). */
void Tent_refresh(Object *tent);
/* Picked up to move it: from now on it goes up again (a tent being taken down
with its pegs out stays as it is, waiting for its pegs). */
void Tent_startMove(Object *tent);
/* What working on it means now ("putting the poles in") and where the hands go. */
const char *Tent_job(const Object *tent);
Vec3 Tent_workSpot(const Object *tent, float side); /* where to stand (side -1 / 0 / +1) */
Vec3 Tent_handsAt(const Object *tent, const Object *who, float clock);
/* In front of the door, and its tent's sleepers' places inside. */
Vec3 Tent_door(const Object *tent);
/* Whose: the owner, or (the big one) who shares it. */
bool Tent_isTheirs(const Object *tent, const Object *who);
/* Somebody's tent (spread out or pitched), or NULL. */
Object *Tent_of(Object *const *objects, int count, const Object *who);
/* Their sleeping bag in it. */
bool Tent_hasBed(const Object *tent, const Object *who);
/* Into it to sleep (lying in their place) / out again in front of the door. */
void Tent_crawlIn(Object *tent, Object *who);
void Tent_crawlOut(Object *who);
/* Every frame: sleeping bags and mats put down at the door go in; whoever woke up in a tent comes out. */
void Tent_update(World *world, float dt);
#endif /* WORLD_TENT_H */