1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-24 09:00:34 +00:00

improved cheating in the Overview

This commit is contained in:
Zeno Rogue 2017-10-09 00:21:39 +02:00
parent c10b18f77d
commit 77212e59e5
4 changed files with 52 additions and 32 deletions

View File

@ -532,8 +532,6 @@ namespace dialog {
string disp(ld x) { if(ne.intval) return its((int) (x+.5)); else return fts(x); }
typedef function<void()> reaction_t;
reaction_t reaction;
void affect(char kind) {
@ -655,8 +653,8 @@ namespace dialog {
if(ne.help != "") {
addHelp(ne.help);
bool scal = !ISMOBILE && !ISPANDORA && size(ne.help) > 160;
if(scal) lastItem().scale = 30;
// bool scal = !ISMOBILE && !ISPANDORA && size(ne.help) > 160;
// if(scal) lastItem().scale = 30;
}
if(ne.editwhat == &vid.alpha) {
@ -808,4 +806,16 @@ namespace dialog {
ne.intbuf = x; ne.intval = &x; ne.s = its(x);
}
void helpToEdit(int& x, int vmin, int vmax, int step, int dft) {
popScreen();
string title = "help";
if(help[0] == '@') {
int iv = help.find("\t");
int id = help.find("\n");
title = help.substr(iv+1, id-iv-1);
help = help.substr(id+1);
}
editNumber(x, vmin, vmax, step, dft, title, help);
}
};

View File

@ -721,6 +721,9 @@ void describeMouseover() {
if(mousey < vid.fsize * 3/2) getcstat = SDLK_F1;
}
string help_action_text;
reaction_t help_action;
void showHelp() {
gamescreen(2);
cmode = sm::HELP | sm::DOTOUR;
@ -744,7 +747,8 @@ void showHelp() {
dialog::addHelp(help);
}
if(help == buildHelpText()) dialog::addItem("credits", 'c');
if(help == buildHelpText()) dialog::addItem(XLAT("credits"), 'c');
if(help_action_text != "") dialog::addItem(help_action_text, 't');
dialog::display();
@ -754,6 +758,8 @@ void showHelp() {
help = "@";
else if(uni == 'c')
help = buildCredits();
else if(uni == 't' && help_action)
help_action();
else if(doexiton(sym, uni))
popScreen();
};
@ -761,5 +767,6 @@ void showHelp() {
void gotoHelp(const string& h) {
help = h;
help_action = reaction_t();
pushScreen(showHelp);
}

View File

@ -300,7 +300,9 @@ extern ld crad;
extern bool mousepressed, anyshiftclick;
extern string help;
extern function<void()> help_delegate;
typedef function<void()> reaction_t;
extern reaction_t help_delegate;
#define HELPFUN(x) (help_delegate = x, "HELPFUN")

View File

@ -139,36 +139,37 @@ void showOverview() {
int umod = uni % 1000;
int udiv = uni / 1000;
if(udiv == 1 && umod < landtypes) {
if(cheater && !hiliteclick) {
eLand l = eLand(umod);
gotoHelp(generateHelpForLand(l));
if(cheater) {
help_action_text = "teleport";
help_action = [l] () {
cheater++;
bool princ = (l == laPrincessQuest);
if(princ) {
if(kills[moVizier] == 0) kills[moVizier] = 1;
princess::forceMouse = true;
princess::gotoPrincess = true;
l = laPalace;
cheatMoveTo(laPalace);
}
cheatMoveTo(l);
popScreen();
else cheatMoveTo(l);
canmove = true;
if(princ) fullcenter();
popScreen();
popScreen();
};
}
else gotoHelp(generateHelpForLand(eLand(umod)));
}
else if(udiv == 2 && umod < ittypes) {
if(cheater && !hiliteclick) {
cheater++;
int ic = itemclass(eItem(umod));
if(ic == IC_TREASURE) items[umod] += PREC(10);
if(ic == IC_ORB) items[umod] += PREC(60);
if(umod == itGreenStone) items[umod] += PREC(100);
else if(ic == IC_OTHER) items[umod] += (shiftmul>0?1:-1);
if(items[umod] < 0) items[umod] = 0;
gotoHelp(generateHelpForItem(eItem(umod)));
if(cheater) {
dialog::helpToEdit(items[umod], 0, 200, 10, 10);
dialog::reaction = [] () {
if(hardcore) canmove = true;
else checkmove();
cheater++;
};
}
else gotoHelp(generateHelpForItem(eItem(umod)));
}
else if(udiv == 3 && umod < walltypes) gotoHelp(generateHelpForWall(eWall(umod)));
else if(uni == SDLK_F1) gotoHelp(