1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-25 17:40:36 +00:00

embeddings:: star probability configurable

This commit is contained in:
Zeno Rogue 2023-02-18 19:33:27 +01:00
parent f73660c801
commit 5a40534c85
2 changed files with 16 additions and 2 deletions

View File

@ -2397,6 +2397,7 @@ EX void show3D_height_details() {
add_edit(vid.infdeep_height);
add_edit(vid.sun_size);
add_edit(vid.star_size);
add_edit(star_prob);
add_edit(vid.height_limits);
if(euclid && msphere) add_edit(use_euclidean_infinity);
}
@ -2763,6 +2764,8 @@ EX int config3 = addHook(hooks_configfile, 100, [] {
->editable(0, 10, .1, "sun size (relative to item sizes)", "", '8');
param_f(vid.star_size, "star_size", "star_size", 0.75)
->editable(0, 10, .1, "night star size (relative to item sizes)", "", '9');
param_f(star_prob, "star_prob", 0.3)
->editable(0, 1, .01, "star probability", "probability of star per tile", '*');
param_b(vid.height_limits, "height_limits", true)
->editable("automatically limit heights if too high", 'l');
param_b(auto_remove_roofs, "auto_remove_roofs", true)

15
sky.cpp
View File

@ -357,6 +357,17 @@ void draw_star(const shiftmatrix& V, const hpcshape& sh, color_t col, ld rev = f
queuepolyat(V1 * zpush(val), sh, col, PPR::SKY);
}
EX ld star_prob = 0.33;
/* the first star is supposed to appear as long as probability > 0 */
EX vector<ld> stars = {1e-20};
EX bool star_for(int i) {
i = i & ((1<<16)-1);
while(isize(stars) <= i) stars.push_back(randd());
return stars[i] < star_prob;
}
void celldrawer::draw_ceiling() {
if(!models::is_perspective(pmodel) || sphere) return;
@ -368,11 +379,11 @@ void celldrawer::draw_ceiling() {
switch(ceiling_category(c)) {
/* ceilingless levels */
case 1: {
if(fieldpattern::fieldval_uniq(c) % 3 == 0)
if(star_for(fieldpattern::fieldval_uniq(c)))
draw_star(V, cgi.shNightStar, 0xFFFFFFFF);
add_to_sky(0x00000F, 0x00000F);
if(c->land == laAsteroids) {
if(fieldpattern::fieldval_uniq(c) % 9 < 3)
if(star_for(fieldpattern::fieldval_uniq(c) ^ 0x5555))
draw_star(V, cgi.shNightStar, 0xFFFFFFFF, true);
int sk = get_skybrightness(-1);
auto sky = draw_shapevec(c, V * MirrorZ, cgi.shFullFloor.levels[SIDE_SKY], 0x000000FF + 0x100 * (sk/17), PPR::SKY);