Nimbin[12]?Games / Entropie / entropie/src/world/weather.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/weather.h 1.3 KB · 38 lines raw
#ifndef WORLD_WEATHER_H
#define WORLD_WEATHER_H

/*
 * Weather: dry spells and showers (on their own, or set in the dev menu).
 * While it rains, drops fall round the camera (none under a roof), the
 * ground near you gets wet (puddles, mud: see wetness.c), everything looks
 * darker and wetter, the sky greys over, a fire burns down faster. People go
 * in out of it (ai.c shelter).
 */

#include "world/world.h"

typedef enum { WEATHER_AUTO, WEATHER_DRY, WEATHER_SHOWER, WEATHER_RAIN, WEATHER_KINDS } WeatherKind;
typedef enum { WIND_AUTO, WIND_CALM, WIND_BREEZE, WIND_STORM, WIND_KINDS } WindKind;

#define WIND_MAX 14.0f /* m/s: the windiest it gets (gusts on top) */

#define RAIN_DROPS 1400

typedef struct RainDrops {
    Vec3 p[RAIN_DROPS];
    bool hidden[RAIN_DROPS]; /* (under a roof: not drawn) */
    unsigned rng;
} RainDrops;

void        Weather_init(World *world);
/* dt real, game_dt game seconds. */
void        Weather_update(World *world, float dt, float game_dt);
void        Weather_draw(World *world, Renderer *renderer);
/* Is there a roof (anything) over this spot? */
bool        Weather_covered(const World *world, Vec3 p);
const char *Weather_name(WeatherKind kind);
const char *Weather_windName(WindKind kind);
/* m/s the wind blows now (gusts and all). */
float       Weather_windSpeed(const World *world);

#endif /* WORLD_WEATHER_H */