1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-30 23:49:53 +00:00

Merge branch 'zenorogue:master' into main

This commit is contained in:
Charlotte Peppers 2022-02-05 21:50:16 -07:00 committed by GitHub
commit a9820ef385
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 120 additions and 29 deletions

View File

@ -109,7 +109,7 @@ EX bool wrongMode(char flags) {
if(casual) return true; if(casual) return true;
if(flags == rg::global) return false; if(flags == rg::global) return false;
if(flags != rg::special_geometry) { if(flags != rg::special_geometry && flags != rg::special_geometry_nicewalls) {
if(!BITRUNCATED) return true; if(!BITRUNCATED) return true;
if(geometry != gNormal) return true; if(geometry != gNormal) return true;
} }
@ -128,12 +128,13 @@ EX bool wrongMode(char flags) {
#if CAP_TOUR #if CAP_TOUR
if(tour::on) return true; if(tour::on) return true;
#endif #endif
if(flags == rg::special_geometry && !ls::single()) eLandStructure dls = lsNiceWalls;
return true; if(flags == rg::special_geometry || flags == rg::racing || flags == rg::princess)
if(flags != rg::special_geometry && ineligible_starting_land) dls = lsSingle;
return true; if(flags == rg::chaos)
if(flags == rg::chaos && !ls::std_chaos()) return true; dls = lsChaos;
if(flags != rg::chaos && flags != rg::special_geometry && !ls::nice_walls()) return true;
if(land_structure != dls) return true;
if((numplayers() > 1) != (flags == rg::multi)) return true; if((numplayers() > 1) != (flags == rg::multi)) return true;
return false; return false;
} }

View File

@ -1706,6 +1706,14 @@ EX void build_horocycles(cell *c, cell *from) {
} }
EX void buildBigStuff(cell *c, cell *from) { EX void buildBigStuff(cell *c, cell *from) {
#if CAP_LEGACY
if(legacy_racing()) {
buildBigStuff_legacy(c, from);
return;
}
#endif
build_walls(c, from); build_walls(c, from);
build_horocycles(c, from); build_horocycles(c, from);

View File

@ -643,7 +643,7 @@ struct info {
} }
if(newdist == OUT_OF_PRISON && princess::challenge) { if(newdist == OUT_OF_PRISON && princess::challenge) {
addMessage(XLAT("Congratulations! Your score is %1.", its(i->value))); addMessage(XLAT("Congratulations! Your score is %1.", its(i->value)));
achievement_gain_once("PRINCESS2"); achievement_gain_once("PRINCESS2", rg::princess);
if(!cheater) achievement_score(36, i->value); if(!cheater) achievement_score(36, i->value);
LATE( showMissionScreen(); ) LATE( showMissionScreen(); )
} }

View File

@ -139,16 +139,7 @@ EX bool collectItem(cell *c2, cell *last, bool telekinesis IS(false)) {
else if(it == itOrbSpeed) playSound(c2, "pickup-speed"); else if(it == itOrbSpeed) playSound(c2, "pickup-speed");
else if(it == itRevolver) playSound(c2, "pickup-key"); else if(it == itRevolver) playSound(c2, "pickup-key");
else playSound(c2, "pickup-orb"); else playSound(c2, "pickup-orb");
if(items[itOrbChoice]) items[itOrbChoice] = 0, had_choice = true; had_choice = items[itOrbChoice];
int oc = orbcharges(it);
if(dual::state && among(it, itOrbTeleport, itOrbFrog, itOrbPhasing, itOrbDash, itOrbRecall)) {
oc = 10;
it = itOrbSpeed;
}
if(c2->land == laAsteroids) oc = 10;
if(markOrb(itOrbIntensity)) oc = intensify(oc);
if(!items[it]) items[it]++;
items[it] += oc;
if(it == itOrbPurity) { if(it == itOrbPurity) {
bool no_curses = true; bool no_curses = true;
@ -162,6 +153,18 @@ EX bool collectItem(cell *c2, cell *last, bool telekinesis IS(false)) {
items[itOrbChoice] += 5; items[itOrbChoice] += 5;
} }
} }
if(had_choice) items[itOrbChoice] = 0;
int oc = orbcharges(it);
if(dual::state && among(it, itOrbTeleport, itOrbFrog, itOrbPhasing, itOrbDash, itOrbRecall)) {
oc = 10;
it = itOrbSpeed;
}
if(c2->land == laAsteroids) oc = 10;
if(markOrb(itOrbIntensity)) oc = intensify(oc);
if(!items[it]) items[it]++;
items[it] += oc;
} }
else if(c2->item == itOrbLife) { else if(c2->item == itOrbLife) {
playSound(c2, "pickup-orb"); // TODO summon playSound(c2, "pickup-orb"); // TODO summon

View File

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

View File

@ -366,6 +366,13 @@ EX bool all_unlocked = false;
EX eLand getNewLand(eLand old) { 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); eLand l = callhandlers(laNone, hooks_nextland, old);
if(l) return l; if(l) return l;

View File

@ -204,7 +204,15 @@ int modecodetable[42][6] = {
EX modecode_t legacy_modecode() { EX modecode_t legacy_modecode() {
if(int(geometry) > 3 || int(variation) > 1) return UNKNOWN; if(int(geometry) > 3 || int(variation) > 1) return UNKNOWN;
if(!ls::nice_walls() && !ls::std_chaos() && !yendor::on && !tactic::on) return UNKNOWN;
bool is_default_land_structure =
(princess::challenge || tactic::on) ? ls::single() :
racing::on ? (land_structure == lsSingle) :
yendor::on ? (land_structure == yendor::get_land_structure()) :
ls::nice_walls();
if(!is_default_land_structure && !ls::std_chaos()) return UNKNOWN;
// compute the old code // compute the old code
int xcode = 0; int xcode = 0;
@ -219,7 +227,7 @@ EX modecode_t legacy_modecode() {
if(elliptic) xcode += 6; if(elliptic) xcode += 6;
} }
if(ls::any_chaos()) xcode += 21; if(ls::any_chaos() && !yendor::on) xcode += 21;
int np = numplayers()-1; if(np<0 || np>5) np=5; int np = numplayers()-1; if(np<0 || np>5) np=5;
@ -238,6 +246,56 @@ EX modecode_t legacy_modecode() {
return mct; 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 #if CAP_COMMANDLINE
/* legacy options */ /* legacy options */
int read_legacy_args() { 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) { EX void placeCrossroadOrbs(cell *c) {
if(racing::on) return;
if(peace::on) return; if(peace::on) return;
if(daily::on) return; if(daily::on) return;
for(auto& oi: orbinfos) { for(auto& oi: orbinfos) {

View File

@ -735,11 +735,19 @@ EX void generate_track() {
for(int i=0; i<MAXPLAYER; i++) race_finish_tick[i] = 0; for(int i=0; i<MAXPLAYER; i++) race_finish_tick[i] = 0;
official_race = (track_code == "OFFICIAL" && modecode() == 2); official_race = (track_code == "OFFICIAL" && modecode() == 2);
if(official_race && isize(oghostset() [specialland]) && race_checksum != oghostset() [specialland] [0].checksum) {
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; official_race = false;
addMessage(XLAT("Race did not generate correctly for some reason -- not ranked")); addMessage(XLAT("Race did not generate correctly for some reason -- not ranked"));
} }
} }
}
bool inrec = false; bool inrec = false;
@ -845,6 +853,9 @@ int readArgs() {
start_game(); start_game();
race_start_tick = 1; race_start_tick = 1;
} }
else if(argis("-rtry")) {
shift(); race_try = argi();
}
else return 1; else return 1;
return 0; return 0;
} }

View File

@ -31,8 +31,10 @@ namespace rg {
static const char global = 'x'; static const char global = 'x';
/** \brief wrongmode only -- change vid.scfg.players then restart_game(rg::nothing) instead */ /** \brief wrongmode only -- change vid.scfg.players then restart_game(rg::nothing) instead */
static const char multi = 'm'; static const char multi = 'm';
/** \brief wrongmode only -- mark achievements for special geometries/variations */ /** \brief wrongmode only -- mark achievements for special geometries/variations, this automatically marks the expected land_structure as lsSingle */
static const char special_geometry = 'g'; static const char special_geometry = 'g';
/** \brief wrongmode only -- mark achievements for special geometries/variations */
static const char special_geometry_nicewalls = 'G';
} }
#endif #endif
@ -1495,7 +1497,7 @@ EX void switch_game_mode(char switchWhat) {
peace::on = false; peace::on = false;
tour::on = false; tour::on = false;
inv::on = false; inv::on = false;
land_structure = lsSingle; land_structure = racing::on ? lsSingle : lsNiceWalls;
princess::challenge = false; princess::challenge = false;
dual::disable(); dual::disable();
break; break;