init
This commit is contained in:
commit
87bff164f1
416 files changed
+279512
No files matched your search
@@ -0,0 +1,18 @@
|
||||
// The biome modifiers (data/scripts/biome_modifiers.lua, BiomeModifiers at biome + 0x170; src/world/biome_modifiers.h) of the biome-map tile under a world point,
|
||||
// and the cold / warm conversions of the materials. Needs the Tables buffer as `tbl` (main.cpp fills both after the fog of war hole images):
|
||||
// per tile: projectile_drag_coeff, entity_gravity_y_multiplier (float bits), bytes (fog_of_war_delta, fire_extinguish_chance, reaction_freeze_chance, reaction_unfreeze_chance), dust_amount (float bits)
|
||||
// per material: cold_freezes_to_material + 1 | cold_freezes_chance_rev << 16, warmth_melts_to_material + 1 | warmth_melts_chance_rev << 16
|
||||
uint bm_fog_base() { const uint n = mats[mats.length() - 1u].w; return 1024u + 9u * n + 132u + n; } // the biome map's width, height, then the fog type per tile
|
||||
uint bm_mods_base() { return bm_fog_base() + 2u + 8192u + 1u + 64u * 6u + 1u + 16u * 3u + 8u * 3272u; }
|
||||
int bm_tile(vec2 w) { // the tile index, -1 outside the map (the world default: drag 1, gravity 1, no chances)
|
||||
const uint fb = bm_fog_base();
|
||||
const int bw = int(tbl[fb]), bh = int(tbl[fb + 1u]);
|
||||
const ivec2 t = ivec2(floor(w / 512.0)) + ivec2(35, 14);
|
||||
if (bw <= 0 || t.x < 0 || t.y < 0 || t.x >= bw || t.y >= bh) return -1;
|
||||
return t.y * bw + t.x;
|
||||
}
|
||||
float bm_drag(vec2 w) { const int t = bm_tile(w); return t < 0 ? 1.0 : uintBitsToFloat(tbl[bm_mods_base() + 4u * uint(t)]); }
|
||||
float bm_gravity(vec2 w) { const int t = bm_tile(w); return t < 0 ? 1.0 : uintBitsToFloat(tbl[bm_mods_base() + 4u * uint(t) + 1u]); }
|
||||
uint bm_bytes(vec2 w) { const int t = bm_tile(w); return t < 0 ? 0u : tbl[bm_mods_base() + 4u * uint(t) + 2u]; } // fog delta | fire extinguish << 8 | freeze << 16 | unfreeze << 24
|
||||
float bm_dust(vec2 w) { const int t = bm_tile(w); return t < 0 ? 0.0 : uintBitsToFloat(tbl[bm_mods_base() + 4u * uint(t) + 3u]); } // the biome modifier dust_amount (post_final.frag: tex_fog .g)
|
||||
uvec2 bm_conversions(uint m) { const uint cb = bm_mods_base() + 8192u * 4u + 2u * m; return uvec2(tbl[cb], tbl[cb + 1u]); }
|
||||
Reference in new issue
Block a user