Nimbin[12]?Games / Entropie / entropie/src/world/clothes.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/clothes.h 2.2 KB · 46 lines raw
#ifndef WORLD_CLOTHES_H
#define WORLD_CLOTHES_H

/*
 * A pullover (the figure's jacket: look.top TOP_JACKET worn, look.jacket_tied
 * round the waist) put down somewhere: everybody's own OBJ_CLOTHES, made the
 * first time it's put down, no mesh while it's with them again. Hung over a
 * chair's back or a railing, spread on the ground to sit on, or folded on a
 * table or a bench.
 */

#include "world/world.h"

typedef enum { CLOTH_SPREAD, CLOTH_HUNG, CLOTH_FOLDED } ClothLay;

typedef struct {
    ClothLay    lay;
    Vec3        at;     /* spread / folded: under it; hung: the top of the edge */
    float       yaw;
    float       gap;    /* hung: how thick the edge is */
    Object     *host;   /* a chair it goes over (it follows the chair), or NULL */
    const char *where;  /* said plainly: "over the chair's back" */
} ClothSpot;

/* Where who's pullover would go now: sitting, over their chair's back or
   under them; else what they look at (look: unit) - a chair, a railing or a
   wall top, a table - or the ground in front. False: nowhere. */
bool        Clothes_spot(const World *world, const Object *who, Vec3 look, ClothSpot *spot);
/* Put down there (taken off first if worn). */
bool        Clothes_putDown(World *world, Object *who, const ClothSpot *spot);
/* With them again: tied round the waist, or on (wear). */
void        Clothes_takeBack(Object *who, bool wear);
/* Where theirs is ("over the chair's back"), or NULL: with them. */
const char *Clothes_where(const Object *who);
/* The same words as said when it was put down (loading a save: the text back to one of ours). */
const char *Clothes_whereText(const char *saved);
/* A pullover put down: its look again (after loading a save). */
void        Clothes_rebuild(Object *cloth);
/* Somebody's pullover lying near this ray (from the eye, dir unit) within reach, or NULL. */
Object     *Clothes_alongRay(const World *world, Vec3 eye, Vec3 dir, float reach);
/* Every frame: pullovers go along with the chair they hang on; people sitting
   down (not the player) now and then put theirs over the chair's back or
   under them, and take it back getting up. */
void        Clothes_update(World *world);

#endif /* WORLD_CLOTHES_H */