mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-11 19:43:52 +00:00
8th open-format addition to the Wowee pipeline. Replaces
WoW's WeatherTypes.dbc / WeatherEffect logic with a single
binary file holding a list of weather states for one zone,
each tagged with intensity bounds, a probability weight,
and duration bounds. The renderer / runtime samples one
entry at a time using weighted-random selection, drives
it for a uniform-random duration in [min, max] sec, then
re-rolls.
• Types: Clear / Rain / Snow / Storm / Sandstorm / Fog /
Blizzard (extensible enum).
• Binary format: magic "WOWA", version 1, name, N entries
each storing (typeId, minIntensity, maxIntensity, weight,
minDurationSec, maxDurationSec).
CLI:
• --info-wow <wow-base> [--json] — inspect a WOW
• --gen-weather-temperate — clear + rain + fog (forest)
• --gen-weather-arctic — snow + blizzard + fog (tundra)
• --gen-weather-desert — clear + sandstorm (dunes)
• --gen-weather-stormy — rain + storm + occasional clear
The 8th open format complementing the rest:
M2 → WOM | WMO → WOB | WMO collision → WOC | ADT → WOT
DBC → JsonDBC | BLP → PNG | Light.dbc → WOL | WeatherTypes.dbc → WOW
Smoke-tested all 4 presets + JSON output. Each preset reads
back identically with the expected entry count and weight
distribution.
82 lines
2.6 KiB
C++
82 lines
2.6 KiB
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace wowee {
|
|
namespace pipeline {
|
|
|
|
// Wowee Open Weather format (.wow) — novel replacement for WoW's
|
|
// WeatherTypes.dbc / WeatherEffect logic. A WOW file holds a list
|
|
// of weather states for one zone (clear / rain / snow / fog / etc.)
|
|
// each tagged with intensity bounds, probability weight, and
|
|
// duration bounds. The renderer / game runtime samples one entry
|
|
// at a time using weighted-random selection, drives it for a
|
|
// uniform-random duration in [minDurationSec, maxDurationSec],
|
|
// then re-rolls.
|
|
//
|
|
// Binary layout (little-endian):
|
|
// magic[4] = "WOWA"
|
|
// version (uint32) = current 1
|
|
// nameLen (uint32) + name bytes
|
|
// entryCount (uint32)
|
|
// entries (each):
|
|
// weatherTypeId (uint32)
|
|
// minIntensity (float)
|
|
// maxIntensity (float)
|
|
// weight (float) -- probability share in selection
|
|
// minDurationSec (uint32)
|
|
// maxDurationSec (uint32)
|
|
struct WoweeWeather {
|
|
enum Type : uint32_t {
|
|
Clear = 0,
|
|
Rain = 1,
|
|
Snow = 2,
|
|
Storm = 3, // rain + lightning
|
|
Sandstorm = 4,
|
|
Fog = 5,
|
|
Blizzard = 6,
|
|
};
|
|
|
|
struct Entry {
|
|
uint32_t weatherTypeId = Clear;
|
|
float minIntensity = 0.0f; // 0..1
|
|
float maxIntensity = 1.0f;
|
|
float weight = 1.0f; // selection probability share
|
|
uint32_t minDurationSec = 60;
|
|
uint32_t maxDurationSec = 600;
|
|
};
|
|
|
|
std::string name;
|
|
std::vector<Entry> entries;
|
|
|
|
bool isValid() const { return !entries.empty(); }
|
|
|
|
// Total weight across all entries — handy for normalizing
|
|
// selection probabilities at the call site.
|
|
float totalWeight() const;
|
|
|
|
static const char* typeName(uint32_t typeId);
|
|
};
|
|
|
|
class WoweeWeatherLoader {
|
|
public:
|
|
static bool save(const WoweeWeather& weather,
|
|
const std::string& basePath);
|
|
static WoweeWeather load(const std::string& basePath);
|
|
static bool exists(const std::string& basePath);
|
|
|
|
// Preset emitters used by --gen-weather variants.
|
|
// makeTemperate — clear-dominant + occasional rain + fog
|
|
// makeArctic — snow-dominant + blizzard + fog
|
|
// makeDesert — clear-dominant + sandstorm
|
|
// makeStormy — heavy rain + storm + occasional clear
|
|
static WoweeWeather makeTemperate(const std::string& zoneName);
|
|
static WoweeWeather makeArctic(const std::string& zoneName);
|
|
static WoweeWeather makeDesert(const std::string& zoneName);
|
|
static WoweeWeather makeStormy(const std::string& zoneName);
|
|
};
|
|
|
|
} // namespace pipeline
|
|
} // namespace wowee
|