1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-20 15:40:26 +00:00

fixed racing official track generation

This commit is contained in:
Zeno Rogue 2022-02-02 03:07:12 +01:00
parent fd634e6de8
commit 064ac7de63
6 changed files with 84 additions and 7 deletions

View File

@ -1704,8 +1704,16 @@ EX void build_horocycles(cell *c, cell *from) {
for(cell *c: cl.lst) if(c->master->alt) currentmap->extend_altmap(c->master);
}
}
EX void buildBigStuff(cell *c, cell *from) {
#if CAP_LEGACY
if(legacy_racing()) {
buildBigStuff_legacy(c, from);
return;
}
#endif
build_walls(c, from);
build_horocycles(c, from);

View File

@ -2466,15 +2466,15 @@ EX void giantLandSwitch(cell *c, int d, cell *from) {
if(!BITRUNCATED && c->land == laCrossroads5 && hrand(100) < 60)
c->wall = waBarrier;
else if(!inv::on && items[itShard] >= 10 && hrand(8000) < 120*orbcrossfun(items[itShard]) && mirror::build(c)) ;
else if(hyperstonesUnlocked() && hrand(8000) < 100 && mirror::build(c)) ;
else if(hyperstonesUnlocked() && !racing::on && hrand(8000) < 100 && mirror::build(c)) ;
else if(tactic::on && isCrossroads(specialland) && hrand(8000) < 120 && mirror::build(c)) ;
else if(c->land == laCrossroads4 && hrand(24000) < 10 && tactic::on)
c->wall = waRose;
else {
if(hyperstonesUnlocked() && hrand(25000) < min(PT(tkills(), 2000), 5000) && notDippingFor(itHyperstone))
if(hyperstonesUnlocked() && !racing::on && hrand(25000) < min(PT(tkills(), 2000), 5000) && notDippingFor(itHyperstone))
c->item = itHyperstone;
int freq = 4000;
if(ls::single() && specialland == laCrossroads5)
if(ls::single() && specialland == laCrossroads5 && !racing::on)
freq = 250;
if(hrand_monster(freq) < items[itHyperstone] && !c->monst) {
// only interesting monsters here!

View File

@ -366,6 +366,13 @@ EX bool all_unlocked = false;
EX eLand getNewLand(eLand old) {
#if CAP_LEGACY
if(legacy_racing()) {
if(old == laMirror && hrand(10) >= ((tactic::on || racing::on) ? 0 : markOrb(itOrbLuck) ? 5 : 2)) return laMirrored;
if(old == laTerracotta && hrand(5) >= ((tactic::on || racing::on) ? 0 : markOrb(itOrbLuck) ? 2 : 1) && !weirdhyperbolic) return laTerracotta;
}
#endif
eLand l = callhandlers(laNone, hooks_nextland, old);
if(l) return l;

View File

@ -246,6 +246,56 @@ EX modecode_t legacy_modecode() {
return mct;
}
#if CAP_RACING
EX bool legacy_racing() {
return racing::on && geometry == gNormal && BITRUNCATED;
}
EX bool rcheck(string which, int qty, int x) {
return hrand(qty) < x;
};
EX int wallchance_legacy(cell *c, bool deepOcean) {
eLand l = c->land;
return
inmirror(c) ? 0 :
isElemental(l) ? 4000 :
l == laCrossroads ? 5000 :
(l == laMirror && !yendor::generating) ? 6000 :
l == laTerracotta ? 250 :
0;
}
EX void buildBigStuff_legacy(cell *c, cell *from) {
int chaosmode = 0;
bool deepOcean = false;
if(geometry == gNormal && celldist(c) < 3 && !GOLDBERG) {
if(top_land && c == cwt.at->master->move(3)->c7) {
buildBarrierStrong(c, 6, true, top_land);
}
}
else if(good_for_wall(c) && rcheck("D", 10000, 20) && !generatingEquidistant && !yendor::on && !tactic::on && !racing::on) {}
else if(ctof(c) && c->land && rcheck("F", 10000, wallchance_legacy(c, deepOcean))) {
int bd = 2 + hrand(2) * 3;
buildBarrier(c, bd);
}
if((!chaosmode) && bearsCamelot(c->land) && is_master(c) && !bt::in() &&
(quickfind(laCamelot) || peace::on || (hrand(2000) < (c->land == laCrossroads4 ? 800 : 200) && horo_ok() && false))) {
}
if(!chaosmode && c->land == laJungle && ctof(c) &&
(quickfind(laMountain) || (hrand(2000) < 100 && horo_ok() &&
!randomPatternsMode && !tactic::on && !yendor::on && !racing::on && landUnlocked(laMountain)))) {}
if(hasbardir(c)) extendBarrier(c);
}
#endif
#if CAP_COMMANDLINE
/* legacy options */
int read_legacy_args() {

View File

@ -570,6 +570,7 @@ EX void placeLocalSpecial(cell *c, int outof, int loc IS(1), int priz IS(1)) {
}
EX void placeCrossroadOrbs(cell *c) {
if(racing::on) return;
if(peace::on) return;
if(daily::on) return;
for(auto& oi: orbinfos) {

View File

@ -735,9 +735,17 @@ EX void generate_track() {
for(int i=0; i<MAXPLAYER; i++) race_finish_tick[i] = 0;
official_race = (track_code == "OFFICIAL" && modecode() == 2);
if(official_race && isize(oghostset() [specialland]) && race_checksum != oghostset() [specialland] [0].checksum) {
official_race = false;
addMessage(XLAT("Race did not generate correctly for some reason -- not ranked"));
if(official_race && isize(oghostset() [specialland])) {
auto& ghost_checksum = oghostset() [specialland] [0].checksum;
/* seems to work despire wrong checksum... */
if(ghost_checksum == 418679) ghost_checksum = 522566;
if(race_checksum != ghost_checksum) {
println(hlog, "race_checksum = ", race_checksum);
println(hlog, "ghost = ", oghostset() [specialland] [0].checksum);
official_race = false;
addMessage(XLAT("Race did not generate correctly for some reason -- not ranked"));
}
}
}
@ -845,6 +853,9 @@ int readArgs() {
start_game();
race_start_tick = 1;
}
else if(argis("-rtry")) {
shift(); race_try = argi();
}
else return 1;
return 0;
}