From 064ac7de63dc96866b5f984cb87da92770473d14 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Wed, 2 Feb 2022 03:07:12 +0100 Subject: [PATCH] fixed racing official track generation --- bigstuff.cpp | 10 +++++++++- landgen.cpp | 6 +++--- landlock.cpp | 7 +++++++ legacy.cpp | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ orbgen.cpp | 1 + racing.cpp | 17 ++++++++++++++--- 6 files changed, 84 insertions(+), 7 deletions(-) diff --git a/bigstuff.cpp b/bigstuff.cpp index 472dc7b5..c319500d 100644 --- a/bigstuff.cpp +++ b/bigstuff.cpp @@ -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); diff --git a/landgen.cpp b/landgen.cpp index 7030dba5..5aac0a28 100644 --- a/landgen.cpp +++ b/landgen.cpp @@ -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! diff --git a/landlock.cpp b/landlock.cpp index ed3aedcd..c0b6fbd0 100644 --- a/landlock.cpp +++ b/landlock.cpp @@ -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; diff --git a/legacy.cpp b/legacy.cpp index 975e1a4f..56253264 100644 --- a/legacy.cpp +++ b/legacy.cpp @@ -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() { diff --git a/orbgen.cpp b/orbgen.cpp index 3c3663b6..77051752 100644 --- a/orbgen.cpp +++ b/orbgen.cpp @@ -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) { diff --git a/racing.cpp b/racing.cpp index 6f3546ab..0d629e00 100644 --- a/racing.cpp +++ b/racing.cpp @@ -735,9 +735,17 @@ EX void generate_track() { for(int i=0; i