1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-25 01:20:37 +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); } string disp(ld x) { if(ne.intval) return its((int) (x+.5)); else return fts(x); }
typedef function<void()> reaction_t;
reaction_t reaction; reaction_t reaction;
void affect(char kind) { void affect(char kind) {
@ -655,8 +653,8 @@ namespace dialog {
if(ne.help != "") { if(ne.help != "") {
addHelp(ne.help); addHelp(ne.help);
bool scal = !ISMOBILE && !ISPANDORA && size(ne.help) > 160; // bool scal = !ISMOBILE && !ISPANDORA && size(ne.help) > 160;
if(scal) lastItem().scale = 30; // if(scal) lastItem().scale = 30;
} }
if(ne.editwhat == &vid.alpha) { if(ne.editwhat == &vid.alpha) {
@ -808,4 +806,16 @@ namespace dialog {
ne.intbuf = x; ne.intval = &x; ne.s = its(x); 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; if(mousey < vid.fsize * 3/2) getcstat = SDLK_F1;
} }
string help_action_text;
reaction_t help_action;
void showHelp() { void showHelp() {
gamescreen(2); gamescreen(2);
cmode = sm::HELP | sm::DOTOUR; cmode = sm::HELP | sm::DOTOUR;
@ -744,7 +747,8 @@ void showHelp() {
dialog::addHelp(help); 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(); dialog::display();
@ -754,6 +758,8 @@ void showHelp() {
help = "@"; help = "@";
else if(uni == 'c') else if(uni == 'c')
help = buildCredits(); help = buildCredits();
else if(uni == 't' && help_action)
help_action();
else if(doexiton(sym, uni)) else if(doexiton(sym, uni))
popScreen(); popScreen();
}; };
@ -761,5 +767,6 @@ void showHelp() {
void gotoHelp(const string& h) { void gotoHelp(const string& h) {
help = h; help = h;
help_action = reaction_t();
pushScreen(showHelp); pushScreen(showHelp);
} }

View File

@ -300,7 +300,9 @@ extern ld crad;
extern bool mousepressed, anyshiftclick; extern bool mousepressed, anyshiftclick;
extern string help; 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") #define HELPFUN(x) (help_delegate = x, "HELPFUN")

View File

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