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:
parent
c10b18f77d
commit
77212e59e5
18
dialogs.cpp
18
dialogs.cpp
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
9
help.cpp
9
help.cpp
@ -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);
|
||||||
}
|
}
|
||||||
|
4
hyper.h
4
hyper.h
@ -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")
|
||||||
|
|
||||||
|
29
menus.cpp
29
menus.cpp
@ -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));
|
||||||
|
if(cheater) {
|
||||||
|
help_action_text = "teleport";
|
||||||
|
help_action = [l] () {
|
||||||
cheater++;
|
cheater++;
|
||||||
bool princ = (l == laPrincessQuest);
|
bool princ = (l == laPrincessQuest);
|
||||||
if(princ) {
|
if(princ) {
|
||||||
if(kills[moVizier] == 0) kills[moVizier] = 1;
|
if(kills[moVizier] == 0) kills[moVizier] = 1;
|
||||||
princess::forceMouse = true;
|
princess::forceMouse = true;
|
||||||
princess::gotoPrincess = true;
|
princess::gotoPrincess = true;
|
||||||
l = laPalace;
|
cheatMoveTo(laPalace);
|
||||||
}
|
}
|
||||||
cheatMoveTo(l);
|
else cheatMoveTo(l);
|
||||||
popScreen();
|
|
||||||
canmove = true;
|
canmove = true;
|
||||||
if(princ) fullcenter();
|
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(umod == itGreenStone) items[umod] += PREC(100);
|
|
||||||
else if(ic == IC_OTHER) items[umod] += (shiftmul>0?1:-1);
|
|
||||||
if(items[umod] < 0) items[umod] = 0;
|
|
||||||
if(hardcore) canmove = true;
|
if(hardcore) canmove = true;
|
||||||
else checkmove();
|
else checkmove();
|
||||||
|
cheater++;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
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(
|
||||||
|
Loading…
Reference in New Issue
Block a user