diff --git a/bigstuff.cpp b/bigstuff.cpp index f3fecd45..745a4405 100644 --- a/bigstuff.cpp +++ b/bigstuff.cpp @@ -965,6 +965,7 @@ int wallchance(cell *c, bool deepOcean) { (l == laMirror && !yendor::generating) ? 6000 : l == laTerracotta ? 250 : (tactic::on && !tactic::trailer) ? 0 : + racing::on ? 0 : l == laCaribbean ? 500 : (l == laWarpSea || l == laWarpCoast) ? 500 : l == laStorms ? 250 : @@ -1038,10 +1039,10 @@ void buildBigStuff(cell *c, cell *from) { else if((archimedean || pseudohept(c)) && isWarped(c->land) && hrand(10000) < 3000 && c->land && buildBarrierNowall(c, eLand(c->land ^ laWarpSea ^ laWarpCoast))) ; - else if((archimedean || pseudohept(c)) && c->land == laCrossroads4 && hrand(10000) < 7000 && c->land && !c->master->alt && !tactic::on && + else if((archimedean || pseudohept(c)) && c->land == laCrossroads4 && hrand(10000) < 7000 && c->land && !c->master->alt && !tactic::on && !racing::on && buildBarrierNowall(c, getNewLand(laCrossroads4))) ; - else if((archimedean || pseudohept(c)) && hrand(I10000) < 20 && !generatingEquidistant && !yendor::on && !tactic::on && !isCrossroads(c->land) && + else if((archimedean || pseudohept(c)) && hrand(I10000) < 20 && !generatingEquidistant && !yendor::on && !tactic::on && !racing::on && !isCrossroads(c->land) && gold() >= R200 && !weirdhyperbolic && !c->master->alt && !inmirror(c) && !isSealand(c->land) && !isHaunted(c->land) && !isGravityLand(c->land) && (c->land != laRlyeh || rlyehComplete()) && @@ -1093,7 +1094,7 @@ void buildBigStuff(cell *c, cell *from) { if((!chaosmode) && bearsCamelot(c->land) && is_master(c) && !binarytiling && (quickfind(laCamelot) || peace::on || (hrand(I2000) < (c->land == laCrossroads4 ? 800 : 200) && horo_ok() && - items[itEmerald] >= U5 && !tactic::on))) { + items[itEmerald] >= U5 && !tactic::on && !racing::on))) { int rtr = newRoundTableRadius(); heptagon *alt = createAlternateMap(c, rtr+14, hsOrigin); if(alt) { @@ -1109,19 +1110,19 @@ void buildBigStuff(cell *c, cell *from) { if(c->land == laRlyeh && ctof(c) && horo_ok() && (quickfind(laTemple) || peace::on || (hrand(I2000) < 100 && items[itStatue] >= U5 && !randomPatternsMode && - !tactic::on && !yendor::on))) + !tactic::on && !yendor::on && !racing::on))) createAlternateMap(c, 2, hsA); if(c->land == laJungle && ctof(c) && (quickfind(laMountain) || (hrand(I2000) < 100 && horo_ok() && - !randomPatternsMode && !tactic::on && !yendor::on && landUnlocked(laMountain)))) + !randomPatternsMode && !tactic::on && !yendor::on && !racing::on && landUnlocked(laMountain)))) createAlternateMap(c, 2, hsA); if(c->land == laOvergrown && ctof(c) && horo_ok() && (quickfind(laClearing) || (hrand(I2000) < 25 && !randomPatternsMode && items[itMutant] >= U5 && isLandIngame(laClearing) && - !tactic::on && !yendor::on))) { + !tactic::on && !yendor::on && !racing::on))) { heptagon *h = createAlternateMap(c, 2, hsA); if(h) clearing::bpdata[h].root = NULL; } @@ -1133,7 +1134,7 @@ void buildBigStuff(cell *c, cell *from) { if(c->land == laOcean && ctof(c) && deepOcean && !generatingEquidistant && !peace::on && horo_ok() && (quickfind(laWhirlpool) || ( - hrand(2000) < (PURE ? 500 : 1000) && !tactic::on && !yendor::on))) + hrand(2000) < (PURE ? 500 : 1000) && !tactic::on && !racing::on && !yendor::on))) createAlternateMap(c, 2, hsA); if(c->land == laCaribbean && horo_ok() && ctof(c) && !c->master->alt) @@ -1146,7 +1147,7 @@ void buildBigStuff(cell *c, cell *from) { (princess::forceMouse ? canReachPlayer(from, moMouse) : (hrand(2000) < (peace::on ? 100 : 20))) && !c->master->alt && - (princess::challenge || kills[moVizier] || peace::on) && !tactic::on && !yendor::on) { + (princess::challenge || kills[moVizier] || peace::on) && !tactic::on && !yendor::on && !racing::on) { createAlternateMap(c, PRADIUS0, hsOrigin, waPalace); celllister cl(c, 5, 1000000, NULL); for(cell *c: cl.lst) if(c->master->alt) generateAlts(c->master); diff --git a/game.cpp b/game.cpp index 7d30d896..a3ae984f 100644 --- a/game.cpp +++ b/game.cpp @@ -7215,7 +7215,7 @@ namespace orbbull { static constexpr bool randterra = false; void terracotta(cell *c) { - if(c->wall == waTerraWarrior && !c->monst) { + if(c->wall == waTerraWarrior && !c->monst && !racing::on) { bool live = false; if(randterra) { c->landparam++; diff --git a/hyper.h b/hyper.h index cbeb4d03..a00706d3 100644 --- a/hyper.h +++ b/hyper.h @@ -4684,6 +4684,7 @@ namespace racing { extern vector track; extern map > trackstage; extern int current_player; + extern vector race_lands; } bool subscreen_split(reaction_t for_each_subscreen); diff --git a/landgen.cpp b/landgen.cpp index aef08aec..20763909 100644 --- a/landgen.cpp +++ b/landgen.cpp @@ -788,7 +788,7 @@ void giantLandSwitch(cell *c, int d, cell *from) { else c2->mondir = NODIR; } } - if(!c->monst && !tactic::on && !yendor::on && !randomPatternsMode && !peace::on && !euclid && hrand(4000) < 10 && !safety) { + if(!c->monst && !tactic::on && !racing::on && !yendor::on && !randomPatternsMode && !peace::on && !euclid && hrand(4000) < 10 && !safety) { c->item = itBabyTortoise; tortoise::babymap[c] = getBits(c) ^ tortoise::getRandomBits(); } @@ -956,7 +956,7 @@ void giantLandSwitch(cell *c, int d, cell *from) { forCellEx(c2, cc[i]) if(c2->wall == waArrowTrap) ok = false; } if(ok) { - for(int i=1; i<4; i++) + if(!racing::on) for(int i=1; i<4; i++) cc[i]->wall = waArrowTrap, cc[i]->wparam = 0; for(int i=0; i<5; i++) @@ -965,7 +965,7 @@ void giantLandSwitch(cell *c, int d, cell *from) { cc[4]->wall = waStone; } } - if(pseudohept(c) && hrand(100) < 40 && c->wall == waNone) { + if(pseudohept(c) && hrand(100) < 40 && c->wall == waNone && !racing::on) { c->wall = waTerraWarrior; c->landparam = randterra ? 0 : 3 + hrand(3); if(hrand(100) < items[itTerra]-10) @@ -1759,7 +1759,7 @@ void giantLandSwitch(cell *c, int d, cell *from) { break; case laHunting: - if(d == 7 && c->land == laHunting) { + if(d == 7 && c->land == laHunting && !racing::on) { if(hrand(1000) < 20) { if(openplains(c)) { if(hrand(2) == 0) { diff --git a/landlock.cpp b/landlock.cpp index b6bda74e..5d59136b 100644 --- a/landlock.cpp +++ b/landlock.cpp @@ -667,7 +667,7 @@ bool rlyehComplete() { } bool lchance(eLand l) { - if(tactic::on || yendor::on || ((geometry || GOLDBERG) && specialland == laElementalWall)) return true; + if(tactic::on || yendor::on || racing::on || ((geometry || GOLDBERG) && specialland == laElementalWall)) return true; if(chaosmode) return hrand(100) < 25; return hrand(100) >= 40 * kills[elementalOf(l)] / (elementalKills()+1); } @@ -724,8 +724,8 @@ hookset *hooks_nextland; eLand getNewLand(eLand old) { - if(old == laMirror && !chaosmode && hrand(10) >= (tactic::on ? 0 : markOrb(itOrbLuck) ? 5 : 2)) return laMirrored; - if(old == laTerracotta && !chaosmode && hrand(5) >= (tactic::on ? 0 : markOrb(itOrbLuck) ? 2 : 1) && !weirdhyperbolic) return laTerracotta; + if(old == laMirror && !chaosmode && hrand(10) >= ((tactic::on || racing::on) ? 0 : markOrb(itOrbLuck) ? 5 : 2)) return laMirrored; + if(old == laTerracotta && !chaosmode && hrand(5) >= ((tactic::on || racing::on) ? 0 : markOrb(itOrbLuck) ? 2 : 1) && !weirdhyperbolic) return laTerracotta; eLand l = callhandlers(laNone, hooks_nextland, old); if(l) return l; @@ -763,6 +763,15 @@ eLand getNewLand(eLand old) { if(old == laEAir && lchance(old)) return hrand(2) ? laEWater : laEFire; if(old == laEWater && lchance(old)) return hrand(2) ? laEEarth : laEAir; if(old == laEFire && lchance(old)) return hrand(2) ? laEEarth : laEAir; + + if(racing::on && old != laElementalWall) { + eLand l = old; + using racing::race_lands; + while(l == old) l = race_lands[hrand(isize(race_lands))]; + if(l == laElementalWall) l = randomElementalLand(); + if(l == laMirror) l = laCrossroads; + return l; + } if(tactic::on && !(tactic::trailer && old == specialland)) return specialland; if(weirdhyperbolic && specialland != old && specialland != laCrossroads4 && !chaosmode && old != laBarrier) return specialland; diff --git a/racing.cpp b/racing.cpp index fa7fa51f..66d9edbc 100644 --- a/racing.cpp +++ b/racing.cpp @@ -19,14 +19,21 @@ static const int TWIDTH = 6; vector track; map > trackstage; +bool bad(cell *c2, cell *c) { + if(!passable(c2, c, P_ISPLAYER)) return true; + if((c2->land == laCrossroads) ^ (c->land == laCrossroads)) return true; + return false; + } + int trackval(cell *c) { int v = celldist(c); int bonus = 0; + if(c->land != laCrossroads) forCellEx(c2, c) { int d = celldist(c2) - v; - if(d < 0 && !passable(c2, c, P_ISPLAYER)) + if(d < 0 && bad(c2, c)) bonus += 2; - if(d == 0 && !passable(c2, c, P_ISPLAYER)) + if(d == 0 && bad(c2, c)) bonus ++; } return v + bonus; @@ -71,7 +78,7 @@ void generate_track() { break; } setdist(c, 4, parent[c]); - forCellEx(c1, c) if(passable(c, c1, P_ISPLAYER) && !parent.count(c1)) { + forCellEx(c1, c) if(!bad(c1, c) && !parent.count(c1)) { parent[c1] = c; cellbydist[trackval(c1)].push_back(c1); } @@ -289,7 +296,6 @@ int readArgs() { stop_game(); shmup::on = true; racing::on = true; - tactic::on = true; timerghost = false; } else return 1; @@ -365,7 +371,9 @@ auto hook = #endif vector race_lands = { - laIce, laDesert, + laHunting, + laIce, + laDesert, laCrossroads, /* need editing */ laCaves, /* need fixing */ @@ -378,7 +386,6 @@ vector race_lands = { laElementalWall, laWildWest, laDragon, - laHunting, laTerracotta, /* disable traps and warriors */ laRuins, };