1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-09 15:39:55 +00:00

read legacy mode codes

This commit is contained in:
Zeno Rogue 2024-06-02 12:24:43 +02:00
parent 59c52a8176
commit 99564ddfc9

View File

@ -202,17 +202,21 @@ int modecodetable[42][6] = {
};
// unused codes: 6 (cheat/tampered), 25, 254, 255
EX eLandStructure get_default_land_structure() {
return
(princess::challenge || tactic::on) ? lsSingle :
racing::on ? lsSingle :
yendor::on ? yendor::get_land_structure() :
lsNiceWalls;
}
EX modecode_t legacy_modecode() {
if(int(geometry) > 3 || int(variation) > 1) return UNKNOWN;
if(casual) return UNKNOWN;
if(bow::weapon) return UNKNOWN;
if(use_custom_land_list) 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();
bool is_default_land_structure = land_structure == get_default_land_structure();
if(!is_default_land_structure && !ls::std_chaos()) return UNKNOWN;
@ -249,6 +253,41 @@ EX modecode_t legacy_modecode() {
return mct;
}
EX void legacy_modecode_read(modecode_t mc) {
if(mc >= FIRST_MODECODE) throw hr_exception("not a legacy modecode");
inv::on = (mc & (1<<11));
peace::on = (mc & (1<<12));
tour::on = (mc & (1<<13));
bool seven = (mc & (1<<14));
mc &= (1<<11)-1;
for(int xcode=0; xcode<42;xcode++) for(int pl=0; pl<6; pl++) if(modecodetable[xcode][pl] == mc) {
if(seven) pl = 7; else pl++;
multi::players = pl;
land_structure = xcode >= 21 ? lsChaos : get_default_land_structure();
xcode %= 21;
shmup::on = 0; hardcore = false;
if(xcode % 3 == 2) shmup::on = true;
if(xcode % 3 == 1) hardcore = true;
xcode /= 3;
geometry = gNormal; variation = eVariation::bitruncated;
if(xcode == 1) variation = eVariation::pure;
if(xcode == 2) geometry = gEuclid;
if(xcode == 3) geometry = gSphere;
if(xcode == 4) geometry = gSphere, variation = eVariation::pure;
if(xcode == 5) geometry = gElliptic;
if(xcode == 6) geometry = gElliptic, variation = eVariation::pure;
use_custom_land_list = false;
bow::weapon = bow::wBlade;
casual = false;
return;
}
throw hr_exception("legacy code not recognized");
}
#if CAP_RACING
EX bool legacy_racing() {
return racing::on && geometry == gNormal && BITRUNCATED;