mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-07 22:49:54 +00:00
ls:: landscape land structure
This commit is contained in:
parent
6b723977dd
commit
fdf83820f2
@ -1132,6 +1132,7 @@ EX void setLandSphere(cell *c) {
|
||||
vector<eLand> euland;
|
||||
map<int, eLand> euland3;
|
||||
map<int, eLand> euland3_hash;
|
||||
EX map<tuple<int, int, int>, eLand> landscape_lands;
|
||||
|
||||
EX eLand& get_euland(int c) {
|
||||
euland.resize(max_vec);
|
||||
@ -1144,6 +1145,8 @@ EX void clear_euland(eLand first) {
|
||||
if(!nonisotropic) euland[0] = euland[1] = euland[max_vec-1] = first;
|
||||
euland3.clear();
|
||||
euland3[0] = first;
|
||||
landscape_lands.clear();
|
||||
landscape_lands[{0,0,0}] = first;
|
||||
}
|
||||
|
||||
bool valid_wall_at(int c) {
|
||||
|
@ -3330,7 +3330,12 @@ EX int config3 = addHook(hooks_configfile, 100, [] {
|
||||
"larger values might produce horodisks with errors or crashing into each other.", 'H');
|
||||
param_i(randomwalk_size, "randomwalk_size", 10)->editable(2, 100, 1,
|
||||
"land size in randomwalk mode",
|
||||
"The average size of a land in randomwalk mode.", 'R');
|
||||
"The average size of a land in randomwalk mode.", 'R')
|
||||
->set_reaction([] { if(game_active) { stop_game(); start_game(); } });
|
||||
param_i(landscape_div, "landscape_div", 32)->editable(1, 100, 1,
|
||||
"land size in landscape mode",
|
||||
"The bigger the value, the larger the lands.", 'R')
|
||||
->set_reaction([] { if(game_active) { stop_game(); start_game(); } });
|
||||
|
||||
param_f(global_boundary_ratio, "global_boundary_ratio")
|
||||
->editable(0, 5, 0.1, "Width of cell boundaries",
|
||||
|
16
landgen.cpp
16
landgen.cpp
@ -2900,13 +2900,25 @@ EX void share_land(cell *c, cell *c2) {
|
||||
c->land = c2->land;
|
||||
}
|
||||
|
||||
EX void set_land_for_geometry(cell *c) {
|
||||
EX int landscape_div = 32;
|
||||
|
||||
EX void set_land_for_geometry(cell *c) {
|
||||
if(!c->land && isize(currentlands)) {
|
||||
if(land_structure == lsTotalChaos) {
|
||||
setland(c, random_land());
|
||||
return;
|
||||
}
|
||||
if(land_structure == lsLandscape) {
|
||||
if(landscape_div < 0) landscape_div = 0;
|
||||
int shift = landscape_div / 2;
|
||||
int a0 = getCdata(c, 0) + shift;
|
||||
int a1 = getCdata(c, 1) + shift;
|
||||
int a2 = getCdata(c, 2) + shift;
|
||||
eLand& l = landscape_lands[{a0/landscape_div,a1/landscape_div,a2/landscape_div}];
|
||||
if(l == laNone) l = random_land();
|
||||
setland(c, l);
|
||||
return;
|
||||
}
|
||||
/* note: Nil patched chaos done in setLandNil */
|
||||
if(ls::patched_chaos() && (cgflags & qFRACTAL)) {
|
||||
share_land(c, fractal_rep(c));
|
||||
@ -3008,7 +3020,7 @@ EX void setdist(cell *c, int d, cell *from) {
|
||||
}
|
||||
#endif
|
||||
|
||||
if(!c->land && from && (WDIM == 3 || !among(from->land, laBarrier, laElementalWall, laHauntedWall, laOceanWall)) && !quotient && ls::chaoticity() < 60) {
|
||||
if(!c->land && from && (WDIM == 3 || !among(from->land, laBarrier, laElementalWall, laHauntedWall, laOceanWall)) && !quotient && ls::chaoticity() < 60 && land_structure != lsLandscape) {
|
||||
if(!hasbardir(c)) setland(c, from->land);
|
||||
}
|
||||
if(c->land == laTemple && ls::any_order()) setland(c, laRlyeh);
|
||||
|
@ -81,7 +81,7 @@ EX eLand firstland = laIce;
|
||||
EX eLand specialland = laIce;
|
||||
|
||||
#if HDR
|
||||
enum eLandStructure { lsNiceWalls, lsChaos, lsPatchedChaos, lsTotalChaos, lsChaosRW, lsWallChaos, lsSingle, lsNoWalls, lsHorodisks, lsVoronoi, lsGUARD };
|
||||
enum eLandStructure { lsNiceWalls, lsChaos, lsPatchedChaos, lsTotalChaos, lsChaosRW, lsWallChaos, lsSingle, lsNoWalls, lsHorodisks, lsVoronoi, lsLandscape, lsGUARD };
|
||||
#endif
|
||||
|
||||
EX eLandStructure land_structure;
|
||||
@ -90,7 +90,7 @@ EX namespace ls {
|
||||
|
||||
EX bool single() { return land_structure == lsSingle; }
|
||||
|
||||
EX bool any_chaos() { return among(land_structure, lsChaos, lsPatchedChaos, lsWallChaos, lsTotalChaos, lsChaosRW); }
|
||||
EX bool any_chaos() { return among(land_structure, lsChaos, lsPatchedChaos, lsWallChaos, lsTotalChaos, lsChaosRW, lsLandscape); }
|
||||
EX bool std_chaos() { return land_structure == lsChaos; }
|
||||
EX bool wall_chaos() { return land_structure == lsWallChaos; }
|
||||
EX bool patched_chaos() { return land_structure == lsPatchedChaos; }
|
||||
@ -110,6 +110,7 @@ EX int chaoticity() {
|
||||
if(land_structure == lsChaosRW) return 80;
|
||||
if(land_structure == lsPatchedChaos) return 60;
|
||||
if(land_structure == lsChaos) return 40;
|
||||
if(land_structure == lsLandscape) return 35;
|
||||
if(land_structure == lsWallChaos) return 30;
|
||||
if(land_structure == lsVoronoi) return 20;
|
||||
if(land_structure == lsSingle) return 0;
|
||||
@ -139,6 +140,8 @@ EX string land_structure_name(bool which) {
|
||||
return XLAT("horodisks");
|
||||
case lsVoronoi:
|
||||
return XLAT("ideal Voronoi");
|
||||
case lsLandscape:
|
||||
return XLAT("landscape");
|
||||
case lsNoWalls:
|
||||
return XLAT("wall-less");
|
||||
default:
|
||||
@ -151,6 +154,8 @@ EX void fix_land_structure_choice() {
|
||||
if(land_structure != lsTotalChaos && land_structure != lsChaosRW)
|
||||
land_structure = lsSingle;
|
||||
}
|
||||
if(land_structure == lsLandscape && !geometry_supports_cdata())
|
||||
land_structure = lsChaosRW;
|
||||
if(tactic::on || princess::challenge)
|
||||
land_structure = lsSingle;
|
||||
if(yendor::on)
|
||||
|
@ -464,6 +464,8 @@ EX void show_chaos() {
|
||||
add_edit(horodisk_from);
|
||||
else if(land_structure == lsChaosRW)
|
||||
add_edit(randomwalk_size);
|
||||
else if(land_structure == lsLandscape)
|
||||
add_edit(landscape_div);
|
||||
else
|
||||
dialog::addBreak(100);
|
||||
dialog::addBack();
|
||||
|
@ -1004,6 +1004,10 @@ EX void save_mode_data(hstream& f) {
|
||||
f.write<char>(5);
|
||||
f.write<int>(randomwalk_size);
|
||||
}
|
||||
if(land_structure == lsLandscape) {
|
||||
f.write<char>(6);
|
||||
f.write<int>(landscape_div);
|
||||
}
|
||||
}
|
||||
|
||||
EX void load_mode_data_with_zero(hstream& f) {
|
||||
@ -1062,6 +1066,10 @@ EX void load_mode_data_with_zero(hstream& f) {
|
||||
randomwalk_size = f.get<int>();
|
||||
break;
|
||||
|
||||
case 6:
|
||||
landscape_div = f.get<int>();
|
||||
break;
|
||||
|
||||
default:
|
||||
throw hstream_exception();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user