1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-27 14:37:16 +00:00
This commit is contained in:
Zeno Rogue 2017-07-25 00:21:36 +02:00
parent fdc1ac1e6e
commit cc03560389
18 changed files with 149 additions and 61 deletions

View File

@ -1,7 +1,7 @@
// Hyperbolic Rogue -- achievements
// Copyright (C) 2011-2016 Zeno Rogue, see 'hyper.cpp' for details
#define NUMLEADER 70
#define NUMLEADER 72
#define SCORE_UNKNOWN (-1)
#define NO_SCORE_YET (-2)
@ -60,6 +60,8 @@ const char* leadernames[NUMLEADER] = {
"Green Grass", // 67
"Spinel", // 68
"Orb Strategy Score", // 69
"Real time to Win-OS", // 70
"Turns to Win-OS", // 71
};
#define LB_STATISTICS 62
@ -633,8 +635,11 @@ void achievement_victory(bool hyper) {
int t = savetime + time(NULL) - timerstart;
int ih1 = hyper ? 15 : shmup::on ? (numplayers() > 1 ? 45 : 29) : 13;
int ih2 = hyper ? 16 : shmup::on ? 30 : 14;
if(hyper && shmup::on) return;
if(hyper && inv::on) return;
int ih1 = hyper ? 15 : inv::on ? 70 : shmup::on ? (numplayers() > 1 ? 45 : 29) : 13;
int ih2 = hyper ? 16 : inv::on ? 71 : shmup::on ? 30 : 14;
int improved = 0;
if(currentscore[ih1] == NO_SCORE_YET || currentscore[ih2] == NO_SCORE_YET)

View File

@ -1,6 +1,6 @@
int backcolor = 0;
int bordcolor = 0;
int forecolor = 0xFFFFFF;
unsigned backcolor = 0;
unsigned bordcolor = 0;
unsigned forecolor = 0xFFFFFF;
int utfsize(char c) {
unsigned char cu = c;

View File

@ -677,7 +677,7 @@ namespace princess {
if(msgid == 0 && d < 20 && inpalace) {
addMessage(XLAT("%The1 kisses you, and begs you to bring %him1 away from here.", m));
}
else if(msgid == 1 && d >= 20 && inpalace) {
else if(msgid == 1 && d >= 20 && inpalace && !peace::on) {
if(m == moPrincess)
addMessage(XLAT("\"I want my revenge. Stun a guard and leave him for me!\"", m));
else
@ -689,7 +689,7 @@ namespace princess {
else if(msgid == 3 && !inpalace) {
addMessage(XLAT("%The1 kisses you, and thanks you for saving %him1.", m));
}
else if(msgid == 4 && !inpalace && m == moPrincess) {
else if(msgid == 4 && !inpalace && m == moPrincess && !peace::on) {
addMessage(XLAT("\"I have been trained to fight with a Hypersian scimitar, you know?\"", m));
}
else if(msgid == 5 && !inpalace) {

View File

@ -50,6 +50,7 @@ struct supersaver {
virtual string save() = 0;
virtual void load(const string& s) = 0;
virtual bool dosave() = 0;
virtual void reset() = 0;
};
vector<shared_ptr<supersaver>> savers;
@ -58,6 +59,7 @@ template<class T> struct dsaver : supersaver {
T& val;
T dft;
bool dosave() { return val != dft; }
void reset() { val = dft; }
dsaver(T& val) : val(val) { }
};
@ -78,6 +80,7 @@ template<class T> struct saverenum : supersaver {
T& val;
T dft;
bool dosave() { return val != dft; }
void reset() { val = dft; }
saverenum<T>(T& v) : val(v) { }
string save() { return its(val); }
void load(const string& s) { val = (T) atoi(s.c_str()); }
@ -234,18 +237,16 @@ void initConfig() {
addsaver(geom3::highdetail, "3D highdetail");
addsaver(geom3::middetail, "3D middetail");
#if CAP_RUG
addsaver(rug::renderonce, "rug-renderonce");
addsaver(rug::rendernogl, "rug-rendernogl");
addsaver(rug::texturesize, "rug-texturesize");
addsaver(rug::scale, "rug-scale");
#endif
addsaverenum(pmodel, "used model");
addsaver(polygonal::SI, "polygon sides");
addsaver(polygonal::STAR, "polygon star factor");
addsaver(polygonal::deg, "polygonal degree");
addsaver(conformal::includeHistory, "include history"); // check!
addsaver(conformal::autobandhistory, "include history"); // check!
addsaver(conformal::lvspeed, "lineview speed");
addsaver(polygonal::maxcoef, "polynomial degree");
@ -280,10 +281,40 @@ void initConfig() {
addsaver(chaosmode, "mode-chaos");
addsaver(inv::on, "mode-Orb Strategy");
addsaver(purehepta, "mode-heptagonal", false);
addsaver(peace::on, "mode-peace");
addsaver(backcolor, "color:background");
addsaver(forecolor, "color:foreground");
addsaver(bordcolor, "color:borders");
addsaver(viewdists, "expansion mode");
shmup::initConfig();
}
void resetModes() {
popAllGames();
if(shmup::on) restartGame('s');
if(inv::on) restartGame('i');
if(chaosmode) restartGame('C');
if(purehepta) restartGame('7');
if(peace::on) restartGame('P');
if(tour::on) restartGame('T');
if(yendor::on) restartGame('y');
if(tactic::on) restartGame('t');
if(randomPatternsMode) restartGame('r');
if(geometry != gNormal) { targetgeometry = gNormal; restartGame('g'); }
}
void resetConfig() {
dynamicval<int> rx(vid.xres, 0);
dynamicval<int> ry(vid.yres, 0);
dynamicval<int> rf(vid.fsize, 0);
dynamicval<bool> rfs(vid.full, false);
for(auto s: savers)
if(s->name.substr(0,5) != "mode-")
s->reset();
}
void saveConfig() {
DEBB(DF_INIT, (debugfile,"save config\n"));
FILE *f = fopen(conffile, "wt");
@ -353,23 +384,21 @@ void loadOldConfig(FILE *f) {
shmup::loadConfig(f);
#if CAP_RUG
aa = rug::renderonce; bb = rug::rendernogl; cc = purehepta; dd = chaosmode;
int ee = vid.steamscore;
double rs = rug::scale;
err=fscanf(f, "%d%d%d%d%lf%d%d", &aa, &bb, &rug::texturesize, &cc, &rs, &ee, &dd);
rug::renderonce = aa; rug::rendernogl = bb; purehepta = cc; chaosmode = dd; vid.steamscore = ee;
rug::scale = rs;
#endif
aa=conformal::includeHistory;
aa=conformal::autobandhistory;
double ps = polygonal::STAR, lv = conformal::lvspeed;
int pmb = pmodel;
err=fscanf(f, "%d%d%lf%d%d%lf",
&pmb, &polygonal::SI, &ps, &polygonal::deg,
&aa, &lv);
pmodel = eModel(pmb);
conformal::includeHistory = aa; polygonal::STAR = ps; conformal::lvspeed = lv;
conformal::autobandhistory = aa; polygonal::STAR = ps; conformal::lvspeed = lv;
aa=conformal::autoband; bb=conformal::autobandhistory; cc=conformal::dospiral;
err=fscanf(f, "%d%d%d%d%d%d",
@ -678,6 +707,8 @@ void switchGL() {
#endif
}
void resetConfigMenu();
void showBasicConfig() {
gamescreen(3);
const char *axmodes[5] = {"OFF", "auto", "light", "heavy", "arrows"};
@ -714,8 +745,8 @@ void showBasicConfig() {
if(CAP_SHMUP && !ISMOBILE)
dialog::addSelItem(XLAT("configure keys/joysticks"), "", 'p');
showAllConfig();
dialog::addItem(XLAT("reset all configuration"), 'R');
if(lang() != 0) {
string tw = "";
string s = XLAT("TRANSLATIONWARNING");
@ -765,8 +796,9 @@ void showBasicConfig() {
}
#endif
if(xuni == 'r') vid.revcontrol = !vid.revcontrol;
if(uni == 'r') vid.revcontrol = !vid.revcontrol;
if(xuni == 'd') vid.drawmousecircle = !vid.drawmousecircle;
if(uni == 'R') pushScreen(resetConfigMenu);
#if ISSTEAM
if(xuni == 'l') vid.steamscore = vid.steamscore^1;
@ -1087,3 +1119,32 @@ void showCustomizeChar() {
};
}
void resetConfigMenu() {
dialog::init(XLAT("reset all configuration"));
dialog::addInfo("Are you sure?");
dialog::addItem("yes, and delete the config file", 'd');
dialog::addItem("yes", 'y');
dialog::addItem("cancel", 'n');
dialog::addItem("reset the special game modes", 'r');
dialog::display();
keyhandler = [] (int sym, int uni) {
dialog::handleNavigation(sym, uni);
if(uni == 'd') {
resetConfig();
unlink(conffile);
popScreen();
}
else if(uni == 'y') {
printf("reseting config\n");
resetConfig();
printf("config reset\n");
popScreen();
}
else if(uni == 'r')
resetModes();
else if(uni == 'n' || doexiton(sym, uni))
popScreen();
};
}

View File

@ -287,7 +287,7 @@ void handleKeyNormal(int sym, int uni) {
if(sym == 'u' || sym == 'e' || sym == SDLK_KP9) movepckeydir(7);
}
#if !ISPANDORA
#if ISPANDORA
if(DEFAULTCONTROL) {
if(sym == SDLK_RIGHT) movepckeydir(0);
if(sym == SDLK_LEFT) movepckeydir(4);

View File

@ -4380,7 +4380,7 @@ bool swordAttack(cell *mt, eMonster who, cell *c, int bb) {
drawParticles(c, winf[c->wall].color, 16);
c->wall = waNone;
}
if(canAttack(mt, who, c, m, AF_SWORD)) {
if(!peace::on && canAttack(mt, who, c, m, AF_SWORD)) {
markOrb(bb ? itOrbSword2: itOrbSword);
int k = tkills();
attackMonster(c, AF_ORSTUN | AF_MSG | AF_SWORD, who);
@ -4398,7 +4398,6 @@ void swordAttackStatic() {
}
void stabbingAttack(cell *mf, cell *mt, eMonster who, int bonuskill) {
if(peace::on) return;
int numsh = 0, numflail = 0, numlance = 0, numslash = 0;
int backdir = neighborId(mt, mf);
@ -4416,6 +4415,8 @@ void stabbingAttack(cell *mf, cell *mt, eMonster who, int bonuskill) {
achievement_count("SLASH", numbb, 0);
numslash += numbb;
}
if(peace::on) return;
for(int t=0; t<mf->type; t++) {
cell *c = mf->mov[t];
@ -4815,7 +4816,7 @@ void specialMoves() {
c->stuntime = 1;
}
else if(m == moPyroCultist) {
else if(m == moPyroCultist && !peace::on) {
bool shot = false;
bool dont_approach = false;
// smaller range on the sphere
@ -6013,7 +6014,7 @@ void knightFlavorMessage(cell *c2) {
else if(msgid == 2 && !tooeasy) {
addMessage(XLAT("\"The Holy Grail is in the center of the Round Table.\""));
}
else if(msgid == 3) {
else if(msgid == 3 && !peace::on) {
addMessage(XLAT("\"I enjoy watching the hyperbug battles.\""));
}
else if(msgid == 4) {
@ -6022,10 +6023,10 @@ void knightFlavorMessage(cell *c2) {
else if(msgid == 5) {
addMessage(XLAT("\"Nice castle, eh?\""));
}
else if(msgid == 6 && items[itSpice] < 10) {
else if(msgid == 6 && items[itSpice] < 10 && !peace::on) {
addMessage(XLAT("\"The Red Rock Valley is dangerous, but beautiful.\""));
}
else if(msgid == 7 && items[itSpice] < 10) {
else if(msgid == 7 && items[itSpice] < 10 && !peace::on) {
addMessage(XLAT("\"Train in the Desert first!\""));
}
else if(msgid == 8) {
@ -6037,7 +6038,7 @@ void knightFlavorMessage(cell *c2) {
else if(msgid == 9 && rad <= lastsize) {
addMessage(XLAT("\"There are %1 floor tiles inside our Table!\"", llts(disksize[rad])));
}
else if(msgid == 10 && !items[itPirate] && !items[itWhirlpool]) {
else if(msgid == 10 && !items[itPirate] && !items[itWhirlpool] && !peace::on) {
addMessage(XLAT("\"Have you tried to take a boat and go into the Ocean? Try it!\""));
}
else if(msgid == 11 && !princess::saved) {
@ -6046,7 +6047,7 @@ void knightFlavorMessage(cell *c2) {
else if(msgid == 12 && !princess::saved) {
addMessage(XLAT("\"I wonder what was there...\""));
}
else if(msgid == 13) {
else if(msgid == 13 && !peace::on) {
addMessage(XLAT("\"Be careful in the Rose Garden! It is beautiful, but very dangerous!\""));
}
else if(msgid == 14) {

View File

@ -235,10 +235,10 @@ void drawPlayerEffects(const transmatrix& V, cell *c, bool onplayer) {
if(shmup::on) {
if(items[itOrbSword])
queuepoly(V*spin(esh+shmup::pc[multi::cpid]->swordangle), shMagicSword, darkena(iinf[itOrbSword].color, 0, 0xC0 + 0x30 * sin(ticks / 200.0)));
queuepoly(V*spin(esh+shmup::pc[multi::cpid]->swordangle), (peace::on ? shMagicShovel : shMagicSword), darkena(iinf[itOrbSword].color, 0, 0xC0 + 0x30 * sin(ticks / 200.0)));
if(items[itOrbSword2])
queuepoly(V*spin(esh+shmup::pc[multi::cpid]->swordangle+M_PI), shMagicSword, darkena(iinf[itOrbSword2].color, 0, 0xC0 + 0x30 * sin(ticks / 200.0)));
queuepoly(V*spin(esh+shmup::pc[multi::cpid]->swordangle+M_PI), (peace::on ? shMagicShovel : shMagicSword), darkena(iinf[itOrbSword2].color, 0, 0xC0 + 0x30 * sin(ticks / 200.0)));
}
else {
@ -258,10 +258,10 @@ void drawPlayerEffects(const transmatrix& V, cell *c, bool onplayer) {
}
if(items[itOrbSword])
queuepoly(Vnow*spin(esh+M_PI+(-1-2*ang)*2*M_PI/S84), shMagicSword, darkena(iinf[itOrbSword].color, 0, 0x80 + 0x70 * sin(ticks / 200.0)));
queuepoly(Vnow*spin(esh+M_PI+(-1-2*ang)*2*M_PI/S84), (peace::on ? shMagicShovel : shMagicSword), darkena(iinf[itOrbSword].color, 0, 0x80 + 0x70 * sin(ticks / 200.0)));
if(items[itOrbSword2])
queuepoly(Vnow*spin(esh+(-1-2*ang)*2*M_PI/S84), shMagicSword, darkena(iinf[itOrbSword2].color, 0, 0x80 + 0x70 * sin(ticks / 200.0)));
queuepoly(Vnow*spin(esh+(-1-2*ang)*2*M_PI/S84), (peace::on ? shMagicShovel : shMagicSword), darkena(iinf[itOrbSword2].color, 0, 0x80 + 0x70 * sin(ticks / 200.0)));
}
}

View File

@ -36,11 +36,7 @@ string buildHelpText() {
if(inv::on)
h += XLAT(
"You are playing in the Orb Strategy Mode. Collecting treasure "
"gives you access to magical Orb powers. In this mode, "
"unlocking requirements are generally higher, and "
"several quests and lands "
"give you extremely powerful Orbs of the Mirror.\n"
inv::helptext
);
else
h += XLAT(
@ -345,13 +341,14 @@ string generateHelpForMonster(eMonster m) {
if(m == moPlayer) {
#if CAP_TOUR
if(tour::on)
if(tour::on || peace::on)
return s+XLAT(
"A tourist from another world. They mutter something about the 'tutorial', "
"and claim that they are here just to learn, and to leave without any treasures. "
"Do not kill them!"
);
#endif
s += XLAT(
"This monster has come from another world, presumably to steal our treasures. "
"Not as fast as an Eagle, not as resilient as the guards from the Palace, "

View File

@ -395,21 +395,21 @@ namespace mapeditor {
void showDrawEditor();
}
#if CAP_RUG
namespace rug {
extern bool rugged;
extern bool renderonce;
extern bool rendernogl;
extern int texturesize;
extern ld scale;
#if CAP_RUG
void show();
void init();
void close();
void actDraw();
void select();
void buildVertexInfo(cell *c, transmatrix V);
}
#endif
}
#define HASLINEVIEW
@ -1045,7 +1045,7 @@ extern cell *recallCell;
extern eLand cheatdest;
void cheatMoveTo(eLand l);
extern int backcolor, bordcolor, forecolor;
extern unsigned backcolor, bordcolor, forecolor;
extern bool overgenerate;
void doOvergenerate();

View File

@ -1,6 +1,6 @@
#define VER "10.0d"
#define VERNUM 10004
#define VERNUM_HEX 0xA004
#define VER "10.0e"
#define VERNUM 10005
#define VERNUM_HEX 0xA005
#define GEN_M 0
#define GEN_F 1

View File

@ -980,7 +980,7 @@ int buildIvy(cell *c, int children, int minleaf) {
if(children && !child)
child = c->mov[i], leafchild = buildIvy(c->mov[i], children-1, 5);
else
c->mov[i]->monst = (leaf++) ? moIvyWait : moIvyHead,
c->mov[i]->monst = (leaf++ || peace::on) ? moIvyWait : moIvyHead,
c->mov[i]->mondir = c->spn(i);
}
}
@ -5349,7 +5349,7 @@ void setdist(cell *c, int d, cell *from) {
if(c->mov[t]->wall == waColumn)
c->mov[t]->item = itNone;
}
if(buildIvy(c, 0, 3)) c->item = itStatue;
if(buildIvy(c, 0, 3) && !peace::on) c->item = itStatue;
}
}
if(c->land == laTemple) {
@ -5371,7 +5371,7 @@ void setdist(cell *c, int d, cell *from) {
c->monst = hrand(3) ? moCultist : moPyroCultist;
else if(hrand(100000) < -d)
c->monst = moCultistLeader;
else if(hrand(5000) < 250)
else if(hrand(5000) < 250 && !peace::on)
c->item = itGrimoire;
else if(hrand(5000) < 10 && (chaosmode ? items[itGrimoire] >= 10 : -d > TEMPLE_EACH * 10) && !peace::on && !inv::on)
c->item = itOrbDragon;

View File

@ -5778,7 +5778,7 @@ S(
"i Pałac (idź za myszą). Można też zwiedzić kilka "
"innych miejsc.")
S("puzzles and exploration", "hádanky a zkoumání")
S("puzzles and exploration", "zagadki i zwiedzanie")
S("cheats", "oszustwa")
S("help for keyboard user", "pomoc dla użytkowników klawiatury")
@ -5786,6 +5786,13 @@ S("mark heptagons", "oznacz siedmiokąty")
S("Collect as many Dodecahedra as you can, then return here!",
"Zbierz jak najwięcej Dwunastościanów i tu wróć!")
S("reset all configuration", "reset konfiguracji")
S("Are you sure?", "Czy na pewno?")
S("yes, and delete the config file", "tak, i skasuj plik konfiguracyjny")
S("yes", "tak")
S("cancel", "anuluj")
S("reset the special game modes", "zresetuj specjalne tryby gry")
#undef Orb

View File

@ -635,7 +635,7 @@ hpcshape
shDogStripes,
shPBody, shPSword, shPKnife,
shHumanFoot, shHumanLeg, shHumanGroin, shHumanNeck, shSkeletalFoot, shYetiFoot,
shMagicSword, shSeaTentacle, shKrakenHead, shKrakenEye, shKrakenEye2,
shMagicSword, shMagicShovel, shSeaTentacle, shKrakenHead, shKrakenEye, shKrakenEye2,
shArrow,
shPHead, shPFace, shGolemhead, shHood, shArmor,
shAztecHead, shAztecCap,
@ -1585,6 +1585,9 @@ void buildpolys() {
if(purehepta) bshape(shMagicSword, PPR_MAGICSWORD, 1, 243);
else bshape(shMagicSword, PPR_MAGICSWORD, 1, 244);
if(purehepta) bshape(shMagicShovel, PPR_MAGICSWORD, 1, 333);
else bshape(shMagicShovel, PPR_MAGICSWORD, 1, 333);
bshape(shBead0, 20, 1, 250);
bshape(shBead1, 20, 1, 251);
@ -2700,6 +2703,8 @@ NEWSHAPE, 331, 1, 1, 0.148337,0.215535, 0.267624,0.150567, 0.262973,0.019662, 0.
// 0 0 1 [000000]
NEWSHAPE, 332, 6, 2, -0.016778,-0.008267, -0.261607,-0.011992,
NEWSHAPE, 333, 1, 2, 0.309841,0.030742, 0.317580,0.053457, 0.334636,0.058055, 0.348174,0.020510, 0.376877,0.022300, 0.687421,0.025648, 0.689655,0.067551, 0.764187,0.063670, 0.857074,0.041713, 0.877970,0.009947,
NEWSHAPE
};

View File

@ -63,7 +63,7 @@ hint hints[] = {
},
[]() {
dialog::addHelp(XLAT(
"Remember that you can right click mostly anything for more information."));
"Remember that you can right click almost anything for more information."));
#if ISMAC
dialog::addHelp(XLAT(
"(You can also use right Shift)\n\n"));

View File

@ -718,7 +718,7 @@ namespace rug {
bool renderonce = false;
bool rendernogl = true;
int texturesize = 512;
double scale = 1.0f;
ld scale = 1.0f;
}
#endif

View File

@ -2301,6 +2301,8 @@ void moveMonster(monster *m, int delta) {
}
else if(m->type == moMetalBeast || m->type == moMetalBeast2)
step /= 2;
else if(m->type == moTortoise && peace::on)
step = 0;
else if(m->type == moTortoise)
step /= 3;
else if(isBull(m->type))

View File

@ -984,17 +984,27 @@ namespace gamestack {
};
void popGame() {
if(gamestack::pushed()) {
gamestack::pop();
}
}
void popAllGames() {
while(gamestack::pushed()) {
gamestack::pop();
}
}
void restartGame(char switchWhat, bool push) {
popScreenAll();
DEBB(DF_INIT, (debugfile,"restartGame\n"));
if(push)
gamestack::push();
else if(gamestack::pushed()) {
gamestack::pop();
return;
}
else {
popAllGames();
achievement_final(true);
#if CAP_SAVE
saveStats();

View File

@ -26,12 +26,12 @@ void setCanvas(presmode mode, char canv) {
mapeditor::whichCanvas = canv;
ld = firstland;
firstland = laCanvas;
restartGame(0, true);
restartGame(0, true);
}
if(mode == pmStop) {
mapeditor::whichCanvas = wc;
firstland = ld;
restartGame(0, false);
popGame();
}
}
@ -80,7 +80,7 @@ bool handleKeyTour(int sym, int uni) {
if((sym == SDLK_RETURN || sym == SDLK_KP_ENTER) && (!inhelp || (flags & QUICKSKIP))) {
if(inhelp) popScreen();
if(geometry || purehepta) {
restartGame(0, false);
popGame();
if(!(flags & QUICKGEO)) return true;
}
if(flags & FINALSLIDE) return true;
@ -92,7 +92,7 @@ bool handleKeyTour(int sym, int uni) {
}
if(sym == SDLK_BACKSPACE) {
if(geometry || purehepta) {
restartGame(0, false);
popGame();
if(!(flags & QUICKGEO)) return true;
}
if(currentslide == 0) { slidehelp(); return true; }
@ -141,7 +141,7 @@ bool handleKeyTour(int sym, int uni) {
}
if(geometry || purehepta) {
restartGame(0, false);
popGame();
presentation(pmGeometryReset);
return true;
}
@ -253,7 +253,7 @@ namespace ss {
keyhandler = [] (int sym, int uni) {
if(uni >= 'a' && uni < 'a' + sssize) {
if(geometry || purehepta) {
restartGame(0, false);
popGame();
presentation(pmGeometryReset);
}
if(slides != wts) {
@ -726,7 +726,7 @@ slide default_slides[] = {
}
if(mode == 3) {
shmup::clearMonsters();
restartGame(0, false);
popGame();
}
}
},