mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-04-01 00:07:02 +00:00
irr:: ignore achievements/leaderboards; rewritten the modecode/finalAchievement code a bit
This commit is contained in:
parent
2ca0629a91
commit
9fc4e5524f
@ -79,6 +79,7 @@ bool wrongMode(char flags) {
|
|||||||
if(flags == rg::global) return false;
|
if(flags == rg::global) return false;
|
||||||
if(nonbitrunc != (flags == rg::bitrunc)) return true;
|
if(nonbitrunc != (flags == rg::bitrunc)) return true;
|
||||||
if(gp::on) return true;
|
if(gp::on) return true;
|
||||||
|
if(irr::on) return true;
|
||||||
|
|
||||||
if((geometry != gNormal) != (flags == rg::geometry)) return true;
|
if((geometry != gNormal) != (flags == rg::geometry)) return true;
|
||||||
|
|
||||||
@ -563,12 +564,14 @@ int next_stat_tick;
|
|||||||
|
|
||||||
void achievement_final(bool really_final) {
|
void achievement_final(bool really_final) {
|
||||||
if(offlineMode) return;
|
if(offlineMode) return;
|
||||||
|
|
||||||
#ifdef HAVE_ACHIEVEMENTS
|
#ifdef HAVE_ACHIEVEMENTS
|
||||||
if(ticks > next_stat_tick) {
|
if(ticks > next_stat_tick) {
|
||||||
upload_score(LB_STATISTICS, time(NULL));
|
upload_score(LB_STATISTICS, time(NULL));
|
||||||
next_stat_tick = ticks + 600000;
|
next_stat_tick = ticks + 600000;
|
||||||
}
|
}
|
||||||
if(cheater) return;
|
if(cheater) return;
|
||||||
|
|
||||||
#if CAP_TOUR
|
#if CAP_TOUR
|
||||||
if(tour::on) return;
|
if(tour::on) return;
|
||||||
#endif
|
#endif
|
||||||
@ -584,13 +587,6 @@ void achievement_final(bool really_final) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(sphere && specialland == laHalloween) {
|
|
||||||
if(shmup::on || chaosmode || nonbitrunc || numplayers() > 1 || tactic::on || randomPatternsMode)
|
|
||||||
return;
|
|
||||||
achievement_score(LB_HALLOWEEN, items[itTreat]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if CAP_DAILY
|
#if CAP_DAILY
|
||||||
if(daily::on) {
|
if(daily::on) {
|
||||||
daily::uploadscore(really_final);
|
daily::uploadscore(really_final);
|
||||||
@ -598,33 +594,42 @@ void achievement_final(bool really_final) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
int specialcode = 0;
|
||||||
|
if(shmup::on) specialcode++;
|
||||||
|
if(chaosmode) specialcode+=2;
|
||||||
|
if(nonbitrunc) specialcode+=4;
|
||||||
|
if(numplayers() > 1) specialcode+=8;
|
||||||
|
if(inv::on) specialcode+=16;
|
||||||
|
|
||||||
|
if(sphere && specialland == laHalloween) {
|
||||||
|
if(specialcode) return;
|
||||||
|
achievement_score(LB_HALLOWEEN, items[itTreat]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(geometry) return;
|
if(geometry) return;
|
||||||
|
if(gp::on) return;
|
||||||
|
if(irr::on) return;
|
||||||
|
|
||||||
// no leaderboards for two special modes at once
|
// determine the correct leaderboard ID for 'total score'
|
||||||
int specials = 0;
|
// or return if no leaderboard for the current mode
|
||||||
if(shmup::on) specials++;
|
int sid;
|
||||||
if(chaosmode) specials++;
|
switch(specialcode) {
|
||||||
if(nonbitrunc) specials++;
|
case 0: sid = 0; break;
|
||||||
if(gp::on) specials++;
|
case 1: sid = 28; break;
|
||||||
#if CAP_DALIY
|
case 2: sid = 53; break;
|
||||||
if(daily::on) return;
|
case 4: sid = 57; break;
|
||||||
#endif
|
case 8: sid = 61; break;
|
||||||
if(inv::on) specials++;
|
case 9: sid = 44; break;
|
||||||
if(specials > 1) return;
|
case 16: sid = 69; break;
|
||||||
|
default: return;
|
||||||
if(numplayers() > 1 && chaosmode) return;
|
}
|
||||||
if(numplayers() > 1 && nonbitrunc) return;
|
|
||||||
if(numplayers() > 1 && inv::on) return;
|
|
||||||
|
|
||||||
int total_improved = 0;
|
int total_improved = 0;
|
||||||
specific_improved = 0;
|
specific_improved = 0;
|
||||||
specific_what = 0;
|
specific_what = 0;
|
||||||
|
|
||||||
if(!shmup::on && !chaosmode && !nonbitrunc && numplayers() == 1 && !inv::on) improveItemScores();
|
if(specials == 0) improveItemScores();
|
||||||
|
|
||||||
int sid = nonbitrunc ? 57 : chaosmode ? 53 : shmup::on ? (numplayers() > 1 ? 44 : 28) :
|
|
||||||
inv::on ? 69 :
|
|
||||||
(numplayers() > 1 ? 61 : 0);
|
|
||||||
|
|
||||||
int tg = gold();
|
int tg = gold();
|
||||||
if(tg && haveLeaderboard(sid)) {
|
if(tg && haveLeaderboard(sid)) {
|
||||||
|
1
hyper.h
1
hyper.h
@ -2563,6 +2563,7 @@ namespace irr {
|
|||||||
bool ctof(cell* c);
|
bool ctof(cell* c);
|
||||||
bool supports(eGeometry g);
|
bool supports(eGeometry g);
|
||||||
void visual_creator();
|
void visual_creator();
|
||||||
|
unsigned char density_code();
|
||||||
}
|
}
|
||||||
|
|
||||||
extern hrmap *currentmap;
|
extern hrmap *currentmap;
|
||||||
|
@ -576,6 +576,15 @@ int readArgs() {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned char density_code() {
|
||||||
|
if(sc < 128) return sc;
|
||||||
|
else {
|
||||||
|
int t = 127, a = sc;
|
||||||
|
while(a > 127) a = a * 9/10, t++;
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool pseudohept(cell* c) {
|
bool pseudohept(cell* c) {
|
||||||
return cells[cellindex[c]].is_pseudohept;
|
return cells[cellindex[c]].is_pseudohept;
|
||||||
}
|
}
|
||||||
|
103
yendor.cpp
103
yendor.cpp
@ -795,6 +795,17 @@ namespace tactic {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Identifiers for the current combinations of game modes
|
||||||
|
// These are recorded in the save file, so it is somewhat
|
||||||
|
// important that they do not change for already existing
|
||||||
|
// modes, as otherwise the scores would be lost.
|
||||||
|
// Unfortunately, the codes assigned when HyperRogue had
|
||||||
|
// just a few special modes did not really follow a specific
|
||||||
|
// rule, so this system has grown rather ugly as the
|
||||||
|
// number of special modes kept growing...
|
||||||
|
|
||||||
|
// mode codes for 'old' modes, from 0 to 255
|
||||||
|
|
||||||
int modecodetable[42][6] = {
|
int modecodetable[42][6] = {
|
||||||
{ 0, 38, 39, 40, 41, 42}, // softcore hyperbolic
|
{ 0, 38, 39, 40, 41, 42}, // softcore hyperbolic
|
||||||
{ 7, 43, 44, 45, 46, 47}, // hardcore hyperbolic
|
{ 7, 43, 44, 45, 46, 47}, // hardcore hyperbolic
|
||||||
@ -839,14 +850,14 @@ int modecodetable[42][6] = {
|
|||||||
{242,243,244,245,246,247}, // hardcore heptagonal elliptic chaosmode
|
{242,243,244,245,246,247}, // hardcore heptagonal elliptic chaosmode
|
||||||
{248,249,250,251,252,253}, // shmup heptagonal elliptic chaosmode
|
{248,249,250,251,252,253}, // shmup heptagonal elliptic chaosmode
|
||||||
};
|
};
|
||||||
// unused code: 25
|
// unused codes: 6 (cheat/tampered), 25, 254, 255
|
||||||
int newmodecode = 255;
|
|
||||||
|
|
||||||
int modecode() {
|
int modecode() {
|
||||||
#if CAP_SAVE
|
#if CAP_SAVE
|
||||||
if(anticheat::tampered || cheater) return 6;
|
if(anticheat::tampered || cheater) return 6;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// compute the old code
|
||||||
int xcode = 0;
|
int xcode = 0;
|
||||||
|
|
||||||
if(shmup::on) xcode += 2;
|
if(shmup::on) xcode += 2;
|
||||||
@ -858,82 +869,44 @@ int modecode() {
|
|||||||
if(sphere) {
|
if(sphere) {
|
||||||
xcode += 9;
|
xcode += 9;
|
||||||
if(elliptic) xcode += 6;
|
if(elliptic) xcode += 6;
|
||||||
if(nonbitrunc) xcode += 3;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(chaosmode) xcode += 21;
|
if(chaosmode) xcode += 21;
|
||||||
|
|
||||||
int np = numplayers()-1; if(np<0 || np>5) np=5;
|
int np = numplayers()-1; if(np<0 || np>5) np=5;
|
||||||
|
|
||||||
|
// bits: 0 to 7
|
||||||
int mct = modecodetable[xcode][np];
|
int mct = modecodetable[xcode][np];
|
||||||
|
|
||||||
/*
|
// bits: 9, 10, 15, 16, (reserved for later) 17, 18
|
||||||
if(geometry == gTorus) mct += 512;
|
|
||||||
if(geometry == gZebraQuotient) mct += 1024;
|
|
||||||
if(geometry == gFieldQuotient) mct += 1536;
|
|
||||||
*/
|
|
||||||
#if CAP_INV
|
|
||||||
if(inv::on) mct += 2048;
|
|
||||||
#endif
|
|
||||||
if(peace::on) mct += 4096;
|
|
||||||
#if CAP_TOUR
|
|
||||||
if(tour::on) mct += 8192;
|
|
||||||
#endif
|
|
||||||
if(numplayers() == 7) mct += 16384;
|
|
||||||
|
|
||||||
if(gp::on) {
|
|
||||||
mct += 32768;
|
|
||||||
mct += gp::param.first << 16;
|
|
||||||
mct += gp::param.second << 21;
|
|
||||||
}
|
|
||||||
|
|
||||||
mct += ginf[geometry].xcode;
|
mct += ginf[geometry].xcode;
|
||||||
|
|
||||||
return mct;
|
#if CAP_INV
|
||||||
}
|
if(inv::on) mct += (1<<11);
|
||||||
|
#endif
|
||||||
|
if(peace::on) mct += (1<<12);
|
||||||
|
#if CAP_TOUR
|
||||||
|
if(tour::on) mct += (1<<13);
|
||||||
|
#endif
|
||||||
|
if(numplayers() == 7) mct += (1<<14);
|
||||||
|
|
||||||
void buildmodetable() {
|
// daily/Yendor/Tactics/standard are saved separately, but are using the same codes (Daily uses no code)
|
||||||
bool codeused[600];
|
// randompattern never records its scores
|
||||||
for(int q=0; q<600; q++) codeused[q] = 0;
|
// no specifics of the advanced configuration of torus/fieldquotient currently recorded
|
||||||
|
|
||||||
codeused[6] = true; // cheater
|
if(gp::on) {
|
||||||
|
mct += (1 << 19);
|
||||||
printf("int modecodetable[42][6] = {\n");
|
auto loc = gp::human_representation(gp::param);
|
||||||
|
mct += loc.first << 21; // 4 bits
|
||||||
for(int b=0; b<42; b++) {
|
mct += loc.second << 25; // 4 bits
|
||||||
extern bool hardcore;
|
|
||||||
hardcore = (b%3 == 1);
|
|
||||||
shmup::on = (b%3 == 2);
|
|
||||||
nonbitrunc = (b/3)%7 == 1 || (b/3)%7 == 4 || (b/3)%7 == 6;
|
|
||||||
geometry = gNormal;
|
|
||||||
if((b/3)%7 == 2) geometry = gEuclid;
|
|
||||||
if((b/3)%7 >= 3) geometry = gSphere;
|
|
||||||
if((b/3)%7 >= 5) geometry = gElliptic;
|
|
||||||
chaosmode = b >= 21;
|
|
||||||
printf(" {");
|
|
||||||
for(int p=0; p<6; p++) {
|
|
||||||
multi::players = p+1;
|
|
||||||
if(p) printf(",");
|
|
||||||
int mc = modecode();
|
|
||||||
if(codeused[mc]) mc = newmodecode++;
|
|
||||||
codeused[mc] = true;
|
|
||||||
printf("%3d", mc);
|
|
||||||
}
|
|
||||||
printf("}, //");
|
|
||||||
if(hardcore) printf(" hardcore");
|
|
||||||
else if(shmup::on) printf(" shmup");
|
|
||||||
else printf(" softcore");
|
|
||||||
if(nonbitrunc) printf(" heptagonal");
|
|
||||||
if(euclid) printf(" euclidean");
|
|
||||||
else if(elliptic) printf(" elliptic");
|
|
||||||
else if(sphere) printf(" spherical");
|
|
||||||
else printf(" hyperbolic");
|
|
||||||
if(chaosmode) printf(" chaosmode");
|
|
||||||
printf("\n");
|
|
||||||
}
|
}
|
||||||
printf(" }\n");
|
|
||||||
for(int i=0; i<newmodecode; i++) if(!codeused[i]) printf("// unused code: %d\n", i);
|
if(irr::on) {
|
||||||
printf("int newmodecode = %d;\n", newmodecode);
|
mct += (1 << 20);
|
||||||
|
mct += irr::density_code() << 21; // 8 bits
|
||||||
|
}
|
||||||
|
|
||||||
|
return mct;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace peace {
|
namespace peace {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user