2018-02-08 23:40:26 +00:00
|
|
|
// Hyperbolic Rogue -- debugging routines
|
|
|
|
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
|
|
|
|
|
2019-08-10 11:43:24 +00:00
|
|
|
/** \file debug.cpp
|
|
|
|
* \brief Debugging and cheating
|
|
|
|
*/
|
|
|
|
|
2019-09-05 07:15:40 +00:00
|
|
|
#include "hyper.h"
|
2018-06-10 23:58:31 +00:00
|
|
|
namespace hr {
|
|
|
|
|
2019-08-09 20:07:03 +00:00
|
|
|
EX int steplimit = 0;
|
|
|
|
EX int cstep;
|
2019-08-09 21:24:33 +00:00
|
|
|
EX bool buggyGeneration = false;
|
2020-07-07 19:25:27 +00:00
|
|
|
EX bool debug_cellnames = false;
|
2017-10-08 10:10:40 +00:00
|
|
|
|
2019-08-09 20:07:03 +00:00
|
|
|
EX vector<cell*> buggycells;
|
|
|
|
|
|
|
|
#if HDR
|
|
|
|
template<class... T>
|
|
|
|
void limitgen(T... args) {
|
|
|
|
if(steplimit) {
|
|
|
|
cstep++;
|
|
|
|
printf("%6d ", cstep);
|
|
|
|
printf(args...);
|
|
|
|
if(cstep == steplimit) buggyGeneration = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
2017-10-08 10:10:40 +00:00
|
|
|
|
2019-09-06 06:17:02 +00:00
|
|
|
EX cell *pathTowards(cell *pf, cell *pt) {
|
2017-10-08 10:10:40 +00:00
|
|
|
|
|
|
|
while(celldist(pt) > celldist(pf)) {
|
|
|
|
if(isNeighbor(pf, pt)) return pt;
|
|
|
|
cell *pn = NULL;
|
|
|
|
forCellEx(pn2, pt) if(celldist(pn2) < celldist(pt)) pn = pn2;
|
|
|
|
pt = pn;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(isNeighbor(pf, pt)) return pt;
|
|
|
|
forCellEx(pn2, pt) if(celldist(pn2) < celldist(pt)) return pn2;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool errorReported = false;
|
|
|
|
|
2019-09-06 06:17:02 +00:00
|
|
|
EX void describeCell(cell *c) {
|
2017-10-08 10:10:40 +00:00
|
|
|
if(!c) { printf("NULL\n"); return; }
|
2022-06-23 11:46:14 +00:00
|
|
|
print(hlog, "describe ", lalign(6, c), ": ");
|
|
|
|
vector<cell*> nei;
|
|
|
|
for(int i=0; i<c->type; i++) nei.push_back(c->move(i));
|
|
|
|
println(hlog, ">> ", nei);
|
2017-10-08 10:10:40 +00:00
|
|
|
}
|
|
|
|
|
2017-08-06 12:50:16 +00:00
|
|
|
static int orbid = 0;
|
|
|
|
|
|
|
|
eItem nextOrb() {
|
|
|
|
orbid++;
|
|
|
|
eItem i = eItem(orbid % ittypes);
|
|
|
|
if(itemclass(i) == IC_ORB) return i;
|
|
|
|
else return nextOrb();
|
|
|
|
}
|
|
|
|
|
|
|
|
eItem randomTreasure() {
|
|
|
|
eItem i = eItem(hrand(ittypes));
|
|
|
|
if(itemclass(i) == IC_TREASURE) return i;
|
|
|
|
else return randomTreasure();
|
|
|
|
}
|
|
|
|
|
|
|
|
eItem randomTreasure2(int cv) {
|
|
|
|
int bq = 60000, cq = 0;
|
|
|
|
eItem best = itDiamond;
|
|
|
|
eItem lt = localTreasureType();
|
|
|
|
for(int a=1; a<ittypes; a++) {
|
|
|
|
eItem i = eItem(a);
|
|
|
|
if(itemclass(i) != IC_TREASURE) continue;
|
|
|
|
int q = 2*items[i];
|
|
|
|
if(a == lt) q -= (2*cv-1);
|
2018-08-17 22:46:45 +00:00
|
|
|
if(a == itEmerald && bearsCamelot(cwt.at->land)) q -= 8;
|
|
|
|
if(a == itElixir && isCrossroads(cwt.at->land)) q -= 7;
|
|
|
|
if(a == itIvory && isCrossroads(cwt.at->land)) q -= 6;
|
|
|
|
if(a == itPalace && isCrossroads(cwt.at->land)) q -= 5;
|
|
|
|
if(a == itIvory && cwt.at->land == laJungle) q -= 5;
|
|
|
|
if(a == itIvory && cwt.at->land == laPalace) q -= 5;
|
2017-08-06 12:50:16 +00:00
|
|
|
if(q < bq) bq = q, cq = 0;
|
|
|
|
if(q == bq) { cq++; if(hrand(cq) == 0) best = i; }
|
|
|
|
}
|
|
|
|
return best;
|
|
|
|
}
|
|
|
|
|
2019-08-09 21:39:36 +00:00
|
|
|
EX eLand cheatdest;
|
2017-08-06 12:50:16 +00:00
|
|
|
|
2019-09-06 06:17:02 +00:00
|
|
|
EX void cheatMoveTo(eLand l) {
|
2017-08-06 12:50:16 +00:00
|
|
|
cheatdest = l;
|
|
|
|
if(l == laCrossroads5) l = laCrossroads;
|
|
|
|
activateSafety(l);
|
|
|
|
cheatdest = laNone;
|
|
|
|
}
|
|
|
|
|
2022-06-23 11:46:14 +00:00
|
|
|
struct cheatkey {
|
|
|
|
int key;
|
|
|
|
string desc;
|
|
|
|
reaction_t action;
|
|
|
|
};
|
2017-08-06 12:50:16 +00:00
|
|
|
|
2022-06-23 11:46:14 +00:00
|
|
|
vector<cheatkey> cheats = {
|
|
|
|
cheatkey{'C', "Hyperstone Quest", [] {
|
2017-08-06 12:50:16 +00:00
|
|
|
cheater++;
|
|
|
|
cheatMoveTo(laCrossroads);
|
|
|
|
addMessage(XLAT("Activated the Hyperstone Quest!"));
|
|
|
|
|
|
|
|
for(int t=1; t<ittypes; t++)
|
|
|
|
if(t != itHyperstone && t != itBounty && itemclass(eItem(t)) == IC_TREASURE) {
|
2017-08-14 18:32:09 +00:00
|
|
|
items[t] = inv::on ? 50 : 10;
|
2017-08-06 12:50:16 +00:00
|
|
|
}
|
2017-08-14 18:32:09 +00:00
|
|
|
int qkills = inv::on ? 1000 : 200;
|
|
|
|
kills[moYeti] = qkills;
|
|
|
|
kills[moDesertman] = qkills;
|
|
|
|
kills[moRunDog] = qkills;
|
|
|
|
kills[moZombie] = qkills;
|
|
|
|
kills[moMonkey] = qkills;
|
|
|
|
kills[moCultist] = qkills;
|
|
|
|
kills[moTroll] = qkills;
|
2022-06-23 11:46:14 +00:00
|
|
|
}},
|
|
|
|
cheatkey{'M', "deplete orb powers", [] {
|
2017-08-06 12:50:16 +00:00
|
|
|
for(int i=0; i<ittypes; i++)
|
|
|
|
if(itemclass(eItem(i)) == IC_ORB)
|
|
|
|
items[i] = 0;
|
|
|
|
cheater++; addMessage(XLAT("Orb power depleted!"));
|
2022-06-23 11:46:14 +00:00
|
|
|
}},
|
|
|
|
cheatkey{'O', "summon orbs", [] {
|
2017-08-06 12:50:16 +00:00
|
|
|
cheater++; addMessage(XLAT("Orbs summoned!"));
|
2018-08-17 22:46:45 +00:00
|
|
|
for(int i=0; i<cwt.at->type; i++)
|
|
|
|
if(passable(cwt.at->move(i), NULL, 0)) {
|
2017-08-06 12:50:16 +00:00
|
|
|
eItem it = nextOrb();
|
2018-08-17 22:46:45 +00:00
|
|
|
cwt.at->move(i)->item = it;
|
2017-08-06 12:50:16 +00:00
|
|
|
}
|
2022-06-23 11:46:14 +00:00
|
|
|
}},
|
|
|
|
cheatkey{'F', "gain orb powers", [] {
|
2017-08-06 12:50:16 +00:00
|
|
|
if(hardcore && !canmove) {
|
|
|
|
canmove = true;
|
|
|
|
addMessage(XLAT("Revived!"));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
items[itOrbFlash] += 1;
|
|
|
|
items[itOrbTeleport] += 1;
|
|
|
|
items[itOrbLightning] += 1;
|
|
|
|
items[itOrbSpeed] += 1;
|
|
|
|
items[itOrbShield] += 1;
|
|
|
|
kills[moPlayer] = 0;
|
|
|
|
cheater++; addMessage(XLAT("Orb power gained!"));
|
|
|
|
canmove = true;
|
|
|
|
}
|
2022-06-23 11:46:14 +00:00
|
|
|
}},
|
|
|
|
cheatkey{'R'-64, "advance the rose wave", buildRosemap},
|
|
|
|
#if CAP_EDIT
|
|
|
|
cheatkey{'A', "start the Map Editor", [] {
|
2017-08-06 12:50:16 +00:00
|
|
|
lastexplore = turncount;
|
|
|
|
pushScreen(mapeditor::showMapEditor);
|
2022-06-23 11:46:14 +00:00
|
|
|
}},
|
|
|
|
cheatkey{'A'-64, "start the Vector Graphics Editor", [] {
|
2018-08-17 22:46:45 +00:00
|
|
|
mapeditor::drawcell = mouseover ? mouseover : cwt.at;
|
2017-08-06 12:50:16 +00:00
|
|
|
pushScreen(mapeditor::showDrawEditor);
|
2022-06-23 11:46:14 +00:00
|
|
|
}},
|
|
|
|
#else
|
|
|
|
cheatkey{'A', "take screenshot", [] {
|
2018-12-13 13:53:44 +00:00
|
|
|
pushScreen(shot::menu);
|
2022-06-23 11:46:14 +00:00
|
|
|
}},
|
|
|
|
#endif
|
|
|
|
cheatkey{'T', "summon treasure", [] {
|
2017-08-06 12:50:16 +00:00
|
|
|
items[randomTreasure2(10)] += 10;
|
|
|
|
cheater++; addMessage(XLAT("Treasure gained!"));
|
2022-06-23 11:46:14 +00:00
|
|
|
}},
|
|
|
|
cheatkey{'T'-64, "summon lots of treasure", [] {
|
2017-08-06 12:50:16 +00:00
|
|
|
items[randomTreasure2(100)] += 100;
|
|
|
|
cheater++; addMessage(XLAT("Lots of treasure gained!"));
|
2022-06-23 11:46:14 +00:00
|
|
|
}},
|
|
|
|
cheatkey{'Z', "rotate the character", [] {
|
2018-06-12 20:40:06 +00:00
|
|
|
if (flipplayer) {
|
2018-08-17 22:46:45 +00:00
|
|
|
cwt += cwt.at->type/2;
|
2018-06-12 20:40:06 +00:00
|
|
|
flipplayer = false;
|
|
|
|
}
|
2018-03-24 11:59:01 +00:00
|
|
|
cwt++;
|
2018-06-12 20:40:06 +00:00
|
|
|
mirror::act(1, mirror::SPINSINGLE);
|
2019-10-27 00:30:00 +00:00
|
|
|
cwt.at->mondir++;
|
|
|
|
cwt.at->mondir %= cwt.at->type;
|
2018-06-12 20:40:06 +00:00
|
|
|
|
2018-04-21 10:16:04 +00:00
|
|
|
if(shmup::on) shmup::pc[0]->at = Id;
|
2022-06-23 11:46:14 +00:00
|
|
|
}},
|
|
|
|
cheatkey{'J', "lose all treasure", [] {
|
2017-08-06 12:50:16 +00:00
|
|
|
if(items[localTreasureType()] > 0)
|
|
|
|
items[localTreasureType()] = 0;
|
|
|
|
else for(int i=1; i<ittypes; i++)
|
|
|
|
if(itemclass(eItem(i)) == IC_TREASURE)
|
|
|
|
items[i] = 0;
|
|
|
|
cheater++; addMessage(XLAT("Treasure lost!"));
|
2022-06-23 11:46:14 +00:00
|
|
|
}},
|
|
|
|
cheatkey{'K', "gain kills", [] {
|
2017-08-06 12:50:16 +00:00
|
|
|
for(int i=0; i<motypes; i++) kills[i] += 10;
|
|
|
|
kills[moPlayer] = 0;
|
|
|
|
cheater++; addMessage(XLAT("Kills gained!"));
|
2022-06-23 11:46:14 +00:00
|
|
|
}},
|
|
|
|
cheatkey{'Y', "unlock Orbs of Yendor", [] {
|
2017-08-06 12:50:16 +00:00
|
|
|
for(auto& y: yendor::yi) {
|
|
|
|
if(y.path[YDIST-1]->item == itKey)
|
|
|
|
y.path[YDIST-1]->item = itNone;
|
|
|
|
if(!y.found) items[itKey]++;
|
|
|
|
y.found = true;
|
|
|
|
}
|
|
|
|
cheater++; addMessage(XLAT("Collected the keys!"));
|
2022-06-23 11:46:14 +00:00
|
|
|
}},
|
|
|
|
cheatkey{'Y'-64, "gain Orb of Yendor", [] {
|
2018-08-17 22:46:45 +00:00
|
|
|
yendor::collected(cwt.at);
|
2017-10-31 01:17:12 +00:00
|
|
|
cheater++;
|
2022-06-23 11:46:14 +00:00
|
|
|
}},
|
|
|
|
cheatkey{'P', "save a Princess", [] {
|
2017-08-06 12:50:16 +00:00
|
|
|
items[itSavedPrincess]++;
|
|
|
|
princess::saved = true;
|
|
|
|
princess::everSaved = true;
|
|
|
|
if(inv::on && !princess::reviveAt)
|
|
|
|
princess::reviveAt = gold(NO_LOVE);
|
|
|
|
cheater++; addMessage(XLAT("Saved the Princess!"));
|
2022-06-23 11:46:14 +00:00
|
|
|
}},
|
|
|
|
cheatkey{'S', "Safety (quick save)", [] {
|
2017-08-06 12:50:16 +00:00
|
|
|
canmove = true;
|
2018-08-17 22:46:45 +00:00
|
|
|
cheatMoveTo(cwt.at->land);
|
2017-08-06 12:50:16 +00:00
|
|
|
items[itOrbSafety] += 3;
|
|
|
|
cheater++; addMessage(XLAT("Activated Orb of Safety!"));
|
2022-06-23 11:46:14 +00:00
|
|
|
}},
|
|
|
|
cheatkey{'W'-64, "switch web display", [] {
|
2017-08-06 12:50:16 +00:00
|
|
|
pushScreen(linepatterns::showMenu);
|
2022-06-23 11:46:14 +00:00
|
|
|
}},
|
|
|
|
cheatkey{'G'-64, "switch ghost timer", [] {
|
2017-08-06 12:50:16 +00:00
|
|
|
timerghost = !timerghost;
|
|
|
|
cheater++;
|
|
|
|
addMessage(XLAT("turn count = %1 last exploration = %2 ghost timer = %3",
|
|
|
|
its(turncount), its(lastexplore), ONOFF(timerghost)));
|
2022-06-23 11:46:14 +00:00
|
|
|
}},
|
|
|
|
cheatkey{'G', "edit cell values", push_debug_screen},
|
|
|
|
cheatkey{'L'-64, "cell info", [] {
|
|
|
|
debug_cellnames = !debug_cellnames;
|
2017-08-06 12:50:16 +00:00
|
|
|
cell *c = mouseover;
|
2022-06-23 11:46:14 +00:00
|
|
|
if(!c) return;
|
2017-08-06 12:50:16 +00:00
|
|
|
describeCell(c);
|
2022-06-23 11:46:14 +00:00
|
|
|
}},
|
|
|
|
cheatkey{'P'-64, "peaceful mode", [] {
|
2017-08-06 12:50:16 +00:00
|
|
|
peace::on = !peace::on;
|
2022-06-23 11:46:14 +00:00
|
|
|
}},
|
2017-08-06 12:50:16 +00:00
|
|
|
#ifdef CHEAT_DISABLE_ALLOWED
|
2022-06-23 11:46:14 +00:00
|
|
|
cheatkey{'D'-64, "cheat disable", [] {
|
2017-08-06 12:50:16 +00:00
|
|
|
cheater = 0; autocheat = 0;
|
|
|
|
}
|
|
|
|
#endif
|
2022-06-23 11:46:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
EX bool applyCheat(char u) {
|
|
|
|
for(auto& ch: cheats) if(u == ch.key) {
|
|
|
|
ch.action();
|
|
|
|
return true;
|
|
|
|
}
|
2017-08-06 12:50:16 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
template<class T> string dnameof2(T x) {
|
|
|
|
string s = dnameof(x);
|
|
|
|
return s + " (" + its(x) + ")";
|
|
|
|
}
|
|
|
|
|
|
|
|
template<class T> string dnameof2(T x, int p) {
|
|
|
|
string s = dnameof(x);
|
|
|
|
return s + " (" + its(x) + "/" + its(p) + ")";
|
|
|
|
}
|
|
|
|
|
2019-08-09 20:07:03 +00:00
|
|
|
EX vector<pair<cellwalker,int> > drawbugs;
|
2017-08-06 12:50:16 +00:00
|
|
|
|
|
|
|
bool debugmode = false;
|
|
|
|
|
2019-01-07 03:50:08 +00:00
|
|
|
// static apparently does not work in old compilers
|
|
|
|
int bitfield_v;
|
|
|
|
|
2019-01-16 23:49:35 +00:00
|
|
|
template<class T> void bitfield_editor(int val, T setter, string help = "") {
|
2019-01-07 03:50:08 +00:00
|
|
|
bitfield_v = val;
|
|
|
|
dialog::editNumber(bitfield_v, 0, 100, 1, bitfield_v, help, "");
|
2019-01-16 23:49:35 +00:00
|
|
|
dialog::reaction = [setter] () { setter(bitfield_v); };
|
2019-01-02 21:03:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
struct debugScreen {
|
|
|
|
|
|
|
|
cell *debugged_cell;
|
2017-08-06 12:50:16 +00:00
|
|
|
|
2019-01-02 21:03:23 +00:00
|
|
|
bool show_debug_data;
|
2017-08-06 12:50:16 +00:00
|
|
|
|
2019-01-02 21:03:23 +00:00
|
|
|
debugScreen() { debugged_cell = NULL; show_debug_data = false; }
|
|
|
|
|
|
|
|
void operator () () {
|
|
|
|
cmode = sm::SIDE | sm::DIALOG_STRICT_X;
|
2022-07-05 09:51:06 +00:00
|
|
|
gamescreen();
|
2019-01-02 21:03:23 +00:00
|
|
|
getcstat = '-';
|
2017-08-06 12:50:16 +00:00
|
|
|
|
2021-05-23 12:33:25 +00:00
|
|
|
dialog::init(show_debug_data ? XLAT("debug values") : XLAT("internal details"));
|
2019-01-02 21:03:23 +00:00
|
|
|
|
|
|
|
for(auto& p: drawbugs)
|
|
|
|
drawBug(p.first, p.second);
|
|
|
|
|
|
|
|
cell *what = debugged_cell;
|
|
|
|
if(!what && current_display->sidescreen) what = mouseover;
|
|
|
|
|
|
|
|
if(what) {
|
2019-02-17 18:39:44 +00:00
|
|
|
#if CAP_SHAPES
|
2019-05-26 16:04:02 +00:00
|
|
|
queuepoly(gmatrix[what], cgi.shAsymmetric, 0x80808080);
|
2019-02-17 18:39:44 +00:00
|
|
|
#endif
|
2019-01-02 21:03:23 +00:00
|
|
|
char buf[200];
|
2020-02-23 02:48:46 +00:00
|
|
|
sprintf(buf, "%p", hr::voidp(what));
|
2019-01-02 21:03:23 +00:00
|
|
|
dialog::addSelItem("mpdist", its(what->mpdist), 'd');
|
|
|
|
dialog::add_action([what] () {
|
|
|
|
bitfield_editor(what->mpdist, [what] (int i) { what->mpdist = 0; }, "generation level");
|
|
|
|
});
|
|
|
|
dialog::addSelItem("land", dnameof2(what->land), 0);
|
|
|
|
dialog::addSelItem("land param (int)", its(what->landparam), 'p');
|
|
|
|
dialog::add_action([what] () { dialog::editNumber(what->landparam, 0, 100, 1, what->landparam, "landparam",
|
|
|
|
"Extra value that is important in some lands. The specific meaning depends on the land."); });
|
|
|
|
dialog::addSelItem("land param (hex)", itsh8(what->landparam), 0);
|
|
|
|
dialog::addSelItem("land param (heat)", fts(HEAT(what)), 't');
|
2019-07-21 20:56:10 +00:00
|
|
|
dialog::addSelItem("cdata",
|
|
|
|
its(getCdata(what, 0))+"/"+its(getCdata(what,1))+"/"+its(getCdata(what,2))+"/"+its(getCdata(what,3))+"/"+itsh(getBits(what)), 't');
|
2019-01-02 21:03:23 +00:00
|
|
|
dialog::add_action([what] () {
|
2019-05-04 16:28:03 +00:00
|
|
|
static ld d = HEAT(what);
|
2019-01-02 21:03:23 +00:00
|
|
|
dialog::editNumber(d, -2, 2, 0.1, d, "landparam",
|
|
|
|
"Extra value that is important in some lands. The specific meaning depends on the land.");
|
|
|
|
dialog::reaction = [what] () { HEAT(what) = d; };
|
|
|
|
});
|
|
|
|
dialog::addSelItem("land flags", its(what->landflags)+"/"+itsh2(what->landflags), 'f');
|
|
|
|
dialog::add_action([what] () {
|
|
|
|
bitfield_editor(what->landflags, [what] (int i) { what->landflags = i; }, "Rarely used.");
|
|
|
|
});
|
|
|
|
dialog::addSelItem("barrier dir", its(what->bardir), 'b');
|
|
|
|
dialog::add_action([what] () {
|
|
|
|
bitfield_editor(what->bardir, [what] (int i) { what->bardir = i; });
|
|
|
|
});
|
|
|
|
dialog::addSelItem("barrier left", dnameof2(what->barleft), 0);
|
|
|
|
dialog::addSelItem("barrier right", dnameof2(what->barright), 0);
|
2019-01-16 23:48:55 +00:00
|
|
|
if(what->item == itBabyTortoise) {
|
2019-01-18 20:03:55 +00:00
|
|
|
dialog::addSelItem(XLAT("baby Tortoise flags"), itsh(tortoise::babymap[what]), 'B');
|
2019-01-16 23:48:55 +00:00
|
|
|
dialog::add_action([what] () {
|
|
|
|
dialog::editNumber(tortoise::babymap[what], 0, (1<<21)-1, 1, getBits(what), "", "");
|
2019-01-18 20:03:55 +00:00
|
|
|
dialog::use_hexeditor();
|
2019-01-16 23:48:55 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
if(what->monst == moTortoise) {
|
2019-01-18 20:03:55 +00:00
|
|
|
dialog::addSelItem(XLAT("adult Tortoise flags"), itsh(tortoise::emap[what]), 'A');
|
2019-01-16 23:48:55 +00:00
|
|
|
dialog::add_action([what] () {
|
|
|
|
tortoise::emap[what] = tortoise::getb(what);
|
|
|
|
dialog::editNumber(tortoise::emap[what], 0, (1<<21)-1, 1, getBits(what), "", "");
|
2019-01-18 20:03:55 +00:00
|
|
|
dialog::use_hexeditor();
|
2019-01-16 23:48:55 +00:00
|
|
|
});
|
|
|
|
}
|
2022-05-06 10:40:48 +00:00
|
|
|
#if CAP_COMPLEX2
|
2021-06-16 11:13:13 +00:00
|
|
|
if(dice::on(what)) {
|
|
|
|
dialog::addSelItem(XLAT("die shape"), dice::die_name(dice::data[what].which), 'A');
|
|
|
|
dialog::add_action_push([what] {
|
|
|
|
dialog::init("die shape");
|
|
|
|
char key = 'a';
|
|
|
|
for(auto shape: dice::die_list) {
|
|
|
|
dialog::addItem(dice::die_name(shape), key++);
|
|
|
|
dialog::add_action([what, shape] {
|
|
|
|
dice::data[what].which = shape;
|
|
|
|
dice::data[what].val = 0;
|
|
|
|
popScreen();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
dialog::display();
|
|
|
|
});
|
|
|
|
dialog::addSelItem(XLAT("die face"), its(dice::data[what].val), 'B');
|
|
|
|
dialog::add_action([what] {
|
|
|
|
auto& dd = dice::data[what];
|
|
|
|
int maxv = shape_faces(dd.which)-1;
|
|
|
|
dialog::editNumber(dd.val, 0, maxv, 1, 0, XLAT("die face"), "");
|
|
|
|
dialog::bound_low(0);
|
|
|
|
dialog::bound_up(maxv);
|
|
|
|
});
|
|
|
|
dialog::addSelItem(XLAT("die direction"), its(dice::data[what].dir), 'C');
|
|
|
|
dialog::add_action([what] {
|
|
|
|
auto& dd = dice::data[what];
|
|
|
|
dialog::editNumber(dd.dir, 0, what->type-1, 1, dd.dir, XLAT("die direction"), "");
|
|
|
|
dialog::bound_low(0);
|
|
|
|
dialog::bound_up(what->type-1);
|
|
|
|
});
|
|
|
|
dialog::addBoolItem_action(XLAT("die mirror status"), dice::data[what].mirrored, 'D');
|
|
|
|
}
|
2022-05-06 10:40:48 +00:00
|
|
|
#endif
|
2019-01-02 21:03:23 +00:00
|
|
|
dialog::addBreak(50);
|
|
|
|
|
|
|
|
if(show_debug_data) {
|
2019-10-27 01:44:01 +00:00
|
|
|
dialog::addSelItem("pointer", s0+buf+"/"+index_pointer(what), 0);
|
2019-01-02 21:03:23 +00:00
|
|
|
dialog::addSelItem("cpdist", its(what->cpdist), 0);
|
|
|
|
dialog::addSelItem("celldist", its(celldist(what)), 0);
|
|
|
|
dialog::addSelItem("celldistance", its(celldistance(cwt.at, what)), 0);
|
|
|
|
dialog::addSelItem("pathdist", its(what->pathdist), 0);
|
|
|
|
dialog::addSelItem("celldistAlt", eubinary ? its(celldistAlt(what)) : "--", 0);
|
|
|
|
dialog::addSelItem("temporary", its(what->listindex), 0);
|
2019-02-17 17:28:20 +00:00
|
|
|
#if CAP_GP
|
2019-01-02 21:03:23 +00:00
|
|
|
if(GOLDBERG)
|
|
|
|
dialog::addSelItem("whirl", sprint(gp::get_local_info(what).relative), 0);
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
2019-01-02 21:03:23 +00:00
|
|
|
#if CAP_RACING
|
|
|
|
if(racing::on) racing::add_debug(what);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
dialog::addSelItem("wall", dnameof2(what->wall, what->wparam), 'w');
|
|
|
|
dialog::add_action([what] () {
|
|
|
|
bitfield_editor(what->wparam, [what] (int i) { what->wparam = i; },
|
|
|
|
"wall parameter");
|
|
|
|
});
|
|
|
|
dialog::addSelItem("item", dnameof(what->item), 0);
|
2019-02-17 17:28:20 +00:00
|
|
|
#if CAP_ARCM
|
2019-12-14 10:42:16 +00:00
|
|
|
if(arcm::in())
|
2019-01-02 21:03:23 +00:00
|
|
|
dialog::addSelItem("ID", its(arcm::id_of(what->master)), 0);
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
2019-01-02 21:03:23 +00:00
|
|
|
dialog::addBreak(50);
|
|
|
|
dialog::addSelItem("monster", dnameof2(what->monst, what->mondir), 'm');
|
|
|
|
dialog::add_action([what] () {
|
|
|
|
bitfield_editor(what->mondir, [what] (int i) { what->mondir = i; },
|
|
|
|
"monster direction");
|
2021-06-16 11:13:24 +00:00
|
|
|
dialog::extra_options = [what] () {
|
|
|
|
dialog::addBoolItem(XLAT("mirrored"), what->monmirror, 'M');
|
|
|
|
};
|
2019-01-02 21:03:23 +00:00
|
|
|
});
|
|
|
|
dialog::addSelItem("stuntime", its(what->stuntime), 's');
|
|
|
|
dialog::add_action([what] () {
|
|
|
|
bitfield_editor(what->stuntime, [what] (int i) { what->stuntime = i; });
|
|
|
|
});
|
|
|
|
dialog::addSelItem("hitpoints", its(what->hitpoints), 'h');
|
|
|
|
dialog::add_action([what] () {
|
|
|
|
bitfield_editor(what->hitpoints, [what] (int i) { what->hitpoints = i; });
|
|
|
|
});
|
|
|
|
dialog::addBreak(50);
|
|
|
|
dialog::addBreak(50);
|
|
|
|
dialog::addItem("show debug data", 'x');
|
|
|
|
dialog::add_action([this] () { show_debug_data = true; });
|
|
|
|
if(!debugged_cell) dialog::addItem("click a cell to edit it", 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2019-01-18 20:03:55 +00:00
|
|
|
dialog::addItem(XLAT("click a cell to view its data"), 0);
|
2019-01-02 21:03:23 +00:00
|
|
|
dialog::addBreak(1000);
|
2017-08-06 12:50:16 +00:00
|
|
|
}
|
2019-01-02 21:03:23 +00:00
|
|
|
dialog::addBack();
|
|
|
|
dialog::display();
|
2018-12-23 12:10:46 +00:00
|
|
|
|
2022-07-01 18:04:45 +00:00
|
|
|
keyhandler = [this] (int sym, int uni) {
|
2019-01-02 21:03:23 +00:00
|
|
|
handlePanning(sym, uni);
|
|
|
|
dialog::handleNavigation(sym, uni);
|
2022-06-23 11:46:14 +00:00
|
|
|
if(applyCheat(uni)) ;
|
2019-01-02 21:03:23 +00:00
|
|
|
else if(sym == PSEUDOKEY_WHEELUP || sym == PSEUDOKEY_WHEELDOWN) ;
|
|
|
|
else if(sym == '-') debugged_cell = mouseover;
|
|
|
|
else if(doexiton(sym, uni)) {
|
|
|
|
popScreen();
|
|
|
|
if(debugmode) quitmainloop = true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-08-09 20:07:03 +00:00
|
|
|
EX void push_debug_screen() {
|
2019-01-02 21:03:23 +00:00
|
|
|
debugScreen ds;
|
|
|
|
pushScreen(ds);
|
2017-08-06 12:50:16 +00:00
|
|
|
}
|
|
|
|
|
2019-08-10 11:43:24 +00:00
|
|
|
/** show the cheat menu */
|
2019-08-09 20:07:03 +00:00
|
|
|
EX void showCheatMenu() {
|
2022-07-05 09:51:06 +00:00
|
|
|
cmode = sm::SIDE | sm::MAYDARK;
|
|
|
|
gamescreen();
|
2017-08-06 12:50:16 +00:00
|
|
|
dialog::init("cheat menu");
|
2022-06-23 11:46:14 +00:00
|
|
|
for(auto& ch: cheats) {
|
|
|
|
dialog::addItem(XLAT(ch.desc), ch.key);
|
|
|
|
dialog::add_action([ch] { ch.action(); popScreen(); });
|
|
|
|
}
|
2017-10-29 19:16:29 +00:00
|
|
|
dialog::addBreak(50);
|
2018-06-12 22:00:01 +00:00
|
|
|
dialog::addBack();
|
2017-08-06 12:50:16 +00:00
|
|
|
dialog::display();
|
|
|
|
}
|
|
|
|
|
2019-08-10 11:43:24 +00:00
|
|
|
/** view all the monsters and items */
|
2019-08-09 20:07:03 +00:00
|
|
|
EX void viewall() {
|
2019-04-05 12:41:09 +00:00
|
|
|
celllister cl(cwt.at, 20, 2000, NULL);
|
|
|
|
|
|
|
|
vector<eMonster> all_monsters;
|
|
|
|
for(int i=0; i<motypes; i++) {
|
|
|
|
eMonster m = eMonster(i);
|
|
|
|
if(!isMultitile(m)) all_monsters.push_back(m);
|
|
|
|
}
|
|
|
|
|
|
|
|
for(cell *c: cl.lst) {
|
|
|
|
if(isPlayerOn(c)) continue;
|
|
|
|
bool can_put_monster = true;
|
|
|
|
forCellEx(c2, c) if(c2->monst || isPlayerOn(c2)) can_put_monster = false;
|
|
|
|
if(can_put_monster) {
|
|
|
|
for(int k=0; k<isize(all_monsters); k++)
|
|
|
|
if(passable_for(all_monsters[k], c, nullptr, 0)) {
|
|
|
|
c->monst = all_monsters[k];
|
|
|
|
all_monsters[k] = all_monsters.back();
|
|
|
|
all_monsters.pop_back();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
vector<cell*> itemcells;
|
|
|
|
for(cell *c: cl.lst) {
|
|
|
|
if(isPlayerOn(c) || c->monst || c->item) continue;
|
|
|
|
itemcells.push_back(c);
|
|
|
|
}
|
|
|
|
int id = 0;
|
2019-04-20 22:57:43 +00:00
|
|
|
for(int it=1; it<ittypes; it++) if(it != itBarrow) {
|
2019-04-05 12:41:09 +00:00
|
|
|
if(id >= isize(itemcells)) break;
|
|
|
|
itemcells[id++]->item = eItem(it);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-06 06:38:05 +00:00
|
|
|
#if CAP_COMMANDLINE
|
2020-04-01 09:03:36 +00:00
|
|
|
/** perform a move for the -cmove command */
|
|
|
|
|
2020-04-05 08:48:05 +00:00
|
|
|
int cheat_move_gen = 7;
|
|
|
|
|
2020-04-01 09:03:36 +00:00
|
|
|
void cheat_move(char c) {
|
|
|
|
using arg::cheat;
|
2020-04-05 08:48:05 +00:00
|
|
|
if(c >= '0' && c <= '9' && cheat_move_gen == -1) cheat_move_gen = (c - '0');
|
|
|
|
else if(c >= '0' && c <= '9') cheat(), cwt += (c - '0');
|
|
|
|
else if(c == 's') {
|
|
|
|
cheat();
|
|
|
|
cwt += wstep;
|
|
|
|
playermoved = false;
|
|
|
|
setdist(cwt.at, cheat_move_gen, cwt.peek());
|
|
|
|
if(geometry_supports_cdata()) getCdata(cwt.at, 0);
|
|
|
|
}
|
2020-04-01 09:03:36 +00:00
|
|
|
else if(c == 'r') cheat(), cwt += rev;
|
|
|
|
else if(c == 'm') cheat(), cwt += wmirror;
|
|
|
|
else if(c == 'z') cheat(), cwt.spin = 0, cwt.mirrored = false;
|
2020-04-01 10:01:55 +00:00
|
|
|
else if(c == 'F') centering = eCentering::face, fullcenter();
|
|
|
|
else if(c == 'E') centering = eCentering::edge, fullcenter();
|
|
|
|
else if(c == 'V') centering = eCentering::vertex, fullcenter();
|
2020-04-01 09:26:19 +00:00
|
|
|
else if(c == 'a') cheat(), history::save_end();
|
2020-04-05 08:48:05 +00:00
|
|
|
else if(c == 'g') cheat_move_gen = -1;
|
2020-04-01 09:03:36 +00:00
|
|
|
else println(hlog, "unknown move command: ", c);
|
|
|
|
}
|
2020-04-06 06:38:05 +00:00
|
|
|
#endif
|
2020-04-01 09:03:36 +00:00
|
|
|
|
2019-08-10 11:43:24 +00:00
|
|
|
/** launch a debugging screen, and continue normal working only after this screen is closed */
|
2019-08-09 20:07:03 +00:00
|
|
|
EX void modalDebug(cell *c) {
|
2019-11-13 23:26:50 +00:00
|
|
|
centerover = c; View = Id;
|
2018-01-13 18:19:17 +00:00
|
|
|
if(noGUI) {
|
2020-02-23 02:48:46 +00:00
|
|
|
fprintf(stderr, "fatal: modalDebug called on %p without GUI\n", hr::voidp(c));
|
2018-01-13 18:19:17 +00:00
|
|
|
exit(1);
|
|
|
|
}
|
2019-01-02 21:03:23 +00:00
|
|
|
push_debug_screen();
|
2017-08-06 12:50:16 +00:00
|
|
|
debugmode = true;
|
|
|
|
mainloop();
|
|
|
|
debugmode = false;
|
|
|
|
quitmainloop = false;
|
|
|
|
}
|
|
|
|
|
2019-03-10 13:34:42 +00:00
|
|
|
void test_distances(int max) {
|
|
|
|
int ok = 0, bad = 0;
|
|
|
|
celllister cl(cwt.at, max, 100000, NULL);
|
|
|
|
for(cell *c: cl.lst) {
|
|
|
|
bool is_ok = cl.getdist(c) == celldistance(c, cwt.at);
|
|
|
|
if(is_ok) ok++; else bad++;
|
|
|
|
}
|
|
|
|
println(hlog, "ok=", ok, " bad=", bad);
|
|
|
|
}
|
|
|
|
|
2019-08-09 21:24:33 +00:00
|
|
|
EX void raiseBuggyGeneration(cell *c, const char *s) {
|
2017-08-06 12:50:16 +00:00
|
|
|
|
2020-02-23 02:48:46 +00:00
|
|
|
printf("procgen error (%p): %s\n", hr::voidp(c), s);
|
2017-08-06 12:50:16 +00:00
|
|
|
|
|
|
|
if(!errorReported) {
|
|
|
|
addMessage(string("something strange happened in: ") + s);
|
|
|
|
errorReported = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef BACKTRACE
|
|
|
|
void *array[1000];
|
|
|
|
size_t size;
|
|
|
|
|
|
|
|
// get void*'s for all entries on the stack
|
|
|
|
size = backtrace(array, 1000);
|
|
|
|
|
|
|
|
// print out all the frames to stderr
|
|
|
|
backtrace_symbols_fd(array, size, STDERR_FILENO);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// return;
|
|
|
|
|
2018-07-10 21:03:02 +00:00
|
|
|
if(cheater || autocheat) {
|
2017-08-06 12:50:16 +00:00
|
|
|
drawbugs.emplace_back(cellwalker(c,0), 0xFF000080);
|
|
|
|
modalDebug(c);
|
|
|
|
drawbugs.pop_back();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
c->item = itBuggy;
|
|
|
|
}
|
2018-06-10 23:58:31 +00:00
|
|
|
|
2018-07-19 22:04:23 +00:00
|
|
|
#if CAP_COMMANDLINE
|
|
|
|
|
|
|
|
int read_cheat_args() {
|
|
|
|
using namespace arg;
|
|
|
|
if(argis("-ch")) { cheat(); }
|
|
|
|
else if(argis("-rch")) {
|
|
|
|
PHASEFROM(2); cheat(); reptilecheat = true;
|
|
|
|
}
|
|
|
|
// cheats
|
2020-06-03 13:44:47 +00:00
|
|
|
else if(argis("-g")) {
|
|
|
|
/* debugging mode */
|
|
|
|
if(curphase == 1) {
|
2022-09-15 10:38:39 +00:00
|
|
|
/* use no score file */
|
|
|
|
scorefile = "";
|
2020-06-03 13:44:47 +00:00
|
|
|
/* set seed for reproducible results */
|
|
|
|
if(!fixseed) {
|
|
|
|
fixseed = true; autocheat = true;
|
|
|
|
startseed = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
PHASE(2);
|
|
|
|
/* causes problems in gdb */
|
|
|
|
mouseaim_sensitivity = 0;
|
|
|
|
/* do not any play sounds while debugging */
|
|
|
|
effvolume = 0;
|
|
|
|
musicvolume = 0;
|
|
|
|
}
|
2020-06-03 09:45:52 +00:00
|
|
|
else if(argis("-WS")) {
|
2018-07-19 22:04:23 +00:00
|
|
|
PHASE(3);
|
|
|
|
shift();
|
|
|
|
activateSafety(readland(args()));
|
|
|
|
cheat();
|
|
|
|
}
|
2020-06-03 09:45:52 +00:00
|
|
|
else if(argis("-WT")) {
|
|
|
|
PHASE(3);
|
|
|
|
shift();
|
|
|
|
teleportToLand(readland(args()), false);
|
|
|
|
cheat();
|
|
|
|
}
|
2018-07-19 22:04:23 +00:00
|
|
|
else if(argis("-W2")) {
|
|
|
|
shift(); cheatdest = readland(args()); cheat();
|
|
|
|
showstartmenu = false;
|
2022-12-13 18:05:39 +00:00
|
|
|
cheatdest_list.clear();
|
|
|
|
}
|
|
|
|
else if(argis("-W3")) {
|
|
|
|
shift(); cheatdest_list.push_back(readland(args())); cheat();
|
|
|
|
showstartmenu = false;
|
2018-07-19 22:04:23 +00:00
|
|
|
}
|
|
|
|
else if(argis("-I")) {
|
|
|
|
PHASE(3) cheat();
|
|
|
|
shift(); eItem i = readItem(args());
|
|
|
|
shift(); items[i] = argi();
|
|
|
|
}
|
|
|
|
else if(argis("-IP")) {
|
|
|
|
PHASE(3) cheat();
|
|
|
|
shift(); eItem i = readItem(args());
|
|
|
|
shift(); int q = argi();
|
|
|
|
placeItems(q, i);
|
|
|
|
}
|
|
|
|
else if(argis("-SM")) {
|
|
|
|
PHASEFROM(2);
|
2018-11-17 18:24:02 +00:00
|
|
|
shift(); vid.stereo_mode = eStereo(argi());
|
2018-07-19 22:04:23 +00:00
|
|
|
}
|
2020-04-01 09:03:36 +00:00
|
|
|
else if(argis("-cmove")) {
|
|
|
|
PHASE(3); shift();
|
|
|
|
for(char c: args()) cheat_move(c);
|
|
|
|
}
|
2020-02-26 00:29:44 +00:00
|
|
|
else if(argis("-ipd")) {
|
|
|
|
PHASEFROM(2);
|
|
|
|
shift_arg_formula(vid.ipd);
|
|
|
|
}
|
2018-07-19 22:04:23 +00:00
|
|
|
#if CAP_INV
|
|
|
|
else if(argis("-IU")) {
|
|
|
|
PHASE(3) cheat();
|
|
|
|
shift(); eItem i = readItem(args());
|
|
|
|
shift(); inv::usedup[i] += argi();
|
|
|
|
inv::compute();
|
|
|
|
}
|
|
|
|
else if(argis("-IX")) {
|
|
|
|
PHASE(3) cheat();
|
|
|
|
shift(); eItem i = readItem(args());
|
|
|
|
shift(); inv::extra_orbs[i] += argi();
|
|
|
|
inv::compute();
|
|
|
|
}
|
|
|
|
#endif
|
2020-10-15 14:33:52 +00:00
|
|
|
#if CAP_COMPLEX2
|
2018-07-19 22:04:23 +00:00
|
|
|
else if(argis("-ambush")) {
|
|
|
|
// make all ambushes use the given number of dogs
|
|
|
|
// example: hyper -W Hunt -IP Shield 1 -ambush 60
|
|
|
|
PHASE(3) cheat();
|
2019-12-08 18:17:28 +00:00
|
|
|
shift(); ambush::fixed_size = argi();
|
2018-07-19 22:04:23 +00:00
|
|
|
}
|
2020-10-15 14:33:52 +00:00
|
|
|
#endif
|
2019-03-10 13:34:42 +00:00
|
|
|
else if(argis("-testdistances")) {
|
|
|
|
PHASE(3); shift(); test_distances(argi());
|
|
|
|
}
|
2018-07-19 22:04:23 +00:00
|
|
|
else if(argis("-M")) {
|
2019-05-08 16:33:08 +00:00
|
|
|
PHASE(3) cheat(); start_game(); if(WDIM == 3) { drawthemap(); bfs(); }
|
2018-07-19 22:04:23 +00:00
|
|
|
shift(); eMonster m = readMonster(args());
|
|
|
|
shift(); int q = argi();
|
2020-03-07 03:38:07 +00:00
|
|
|
printf("m = %s q = %d\n", dnameof(m).c_str(), q);
|
2018-07-19 22:04:23 +00:00
|
|
|
restoreGolems(q, m, 7);
|
|
|
|
}
|
|
|
|
else if(argis("-MK")) {
|
|
|
|
PHASE(3) cheat();
|
|
|
|
shift(); eMonster m = readMonster(args());
|
|
|
|
shift(); kills[m] += argi();
|
|
|
|
}
|
2018-09-23 22:05:05 +00:00
|
|
|
else if(argis("-killeach")) {
|
|
|
|
PHASEFROM(2); start_game();
|
|
|
|
shift(); int q = argi(); cheat();
|
|
|
|
for(int m=0; m<motypes; m++)
|
|
|
|
if(monsterclass(eMonster(m)) == 0)
|
|
|
|
kills[m] = q;
|
|
|
|
}
|
2018-07-19 22:04:23 +00:00
|
|
|
else if(argis("-each")) {
|
|
|
|
PHASEFROM(2); start_game();
|
2019-08-21 05:29:40 +00:00
|
|
|
shift(); int q = argi(); cheat();
|
2018-07-19 22:04:23 +00:00
|
|
|
for(int i=0; i<ittypes; i++)
|
|
|
|
if(itemclass(eItem(i)) == IC_TREASURE)
|
|
|
|
items[i] = q;
|
|
|
|
}
|
2023-01-04 22:27:27 +00:00
|
|
|
else if(argis("-each-random")) {
|
|
|
|
PHASEFROM(2); start_game(); cheat();
|
|
|
|
for(int i=0; i<ittypes; i++)
|
|
|
|
if(itemclass(eItem(i)) == IC_TREASURE) {
|
|
|
|
items[i] = 10 + hrand(21);
|
|
|
|
if(i == itElemental) items[i] = 12;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
items[i] = 0;
|
|
|
|
}
|
2019-04-05 12:41:09 +00:00
|
|
|
else if(argis("-viewall")) {
|
|
|
|
PHASE(3); start_game();
|
|
|
|
viewall();
|
|
|
|
}
|
2021-04-15 16:20:28 +00:00
|
|
|
else if(argis("-unlock-all")) {
|
|
|
|
cheat(); all_unlocked = true;
|
|
|
|
}
|
2019-05-05 15:33:31 +00:00
|
|
|
else if(argis("-wef")) {
|
2018-07-19 22:04:23 +00:00
|
|
|
PHASEFROM(2);
|
2019-05-05 15:33:31 +00:00
|
|
|
shift(); int index = argi();
|
2019-05-26 16:04:02 +00:00
|
|
|
shift_arg_formula(whatever[index]);
|
2018-07-19 22:04:23 +00:00
|
|
|
}
|
|
|
|
else if(argis("-wei")) {
|
|
|
|
PHASEFROM(2);
|
2019-05-05 15:33:31 +00:00
|
|
|
shift(); int index = argi();
|
|
|
|
shift(); whateveri[index] = argi();
|
2018-07-19 22:04:23 +00:00
|
|
|
}
|
|
|
|
else if(argis("-W3")) {
|
|
|
|
shift(); top_land = readland(args()); cheat();
|
|
|
|
showstartmenu = false;
|
|
|
|
}
|
|
|
|
else if(argis("-top")) {
|
2022-11-12 21:38:45 +00:00
|
|
|
PHASE(3); View = View * spin(-90._deg);
|
2018-07-19 22:04:23 +00:00
|
|
|
}
|
2021-10-09 07:28:40 +00:00
|
|
|
else if(argis("-idv")) {
|
|
|
|
PHASE(3); View = Id;
|
|
|
|
}
|
2018-07-19 22:04:23 +00:00
|
|
|
else if(argis("-gencells")) {
|
|
|
|
PHASEFROM(2); shift(); start_game();
|
|
|
|
printf("Generating %d cells...\n", argi());
|
2018-08-17 22:46:45 +00:00
|
|
|
celllister cl(cwt.at, 50, argi(), NULL);
|
2018-07-19 22:04:23 +00:00
|
|
|
printf("Cells generated: %d\n", isize(cl.lst));
|
|
|
|
for(int i=0; i<isize(cl.lst); i++)
|
|
|
|
setdist(cl.lst[i], 7, NULL);
|
|
|
|
}
|
|
|
|
else if(argis("-sr")) {
|
|
|
|
PHASEFROM(2);
|
2018-11-30 13:59:29 +00:00
|
|
|
shift(); sightrange_bonus = argi(); vid.use_smart_range = 0;
|
2018-07-19 22:04:23 +00:00
|
|
|
}
|
|
|
|
else if(argis("-srx")) {
|
|
|
|
PHASEFROM(2); cheat();
|
2018-11-30 13:59:29 +00:00
|
|
|
shift(); sightrange_bonus = genrange_bonus = gamerange_bonus = argi(); vid.use_smart_range = 0;
|
2018-07-19 22:04:23 +00:00
|
|
|
}
|
2018-11-06 14:52:59 +00:00
|
|
|
else if(argis("-smart")) {
|
|
|
|
PHASEFROM(2); cheat();
|
|
|
|
vid.use_smart_range = 2;
|
2019-05-08 16:33:08 +00:00
|
|
|
shift_arg_formula(WDIM == 3 ? vid.smart_range_detail_3 : vid.smart_range_detail);
|
2018-11-06 14:52:59 +00:00
|
|
|
}
|
2020-08-20 14:12:04 +00:00
|
|
|
else if(argis("-smartarea")) {
|
|
|
|
PHASEFROM(2); cheat();
|
|
|
|
shift(); vid.smart_area_based = argi();
|
|
|
|
}
|
2018-11-30 13:59:29 +00:00
|
|
|
else if(argis("-smartn")) {
|
|
|
|
PHASEFROM(2);
|
|
|
|
vid.use_smart_range = 1;
|
|
|
|
shift_arg_formula(vid.smart_range_detail);
|
|
|
|
}
|
2018-11-06 14:52:59 +00:00
|
|
|
else if(argis("-smartlimit")) {
|
|
|
|
PHASEFROM(2);
|
|
|
|
shift(); vid.cells_drawn_limit = argi();
|
|
|
|
}
|
2019-08-06 19:04:09 +00:00
|
|
|
else if(argis("-genlimit")) {
|
|
|
|
PHASEFROM(2);
|
|
|
|
shift(); vid.cells_generated_limit = argi();
|
|
|
|
}
|
2019-03-10 11:12:47 +00:00
|
|
|
else if(argis("-sight3")) {
|
|
|
|
PHASEFROM(2);
|
|
|
|
shift_arg_formula(sightranges[geometry]);
|
|
|
|
}
|
2019-05-05 15:35:43 +00:00
|
|
|
else if(argis("-sloppy")) {
|
|
|
|
PHASEFROM(2);
|
|
|
|
vid.sloppy_3d = true;
|
|
|
|
}
|
2019-04-23 16:48:41 +00:00
|
|
|
else if(argis("-gen3")) {
|
|
|
|
PHASEFROM(2);
|
|
|
|
shift_arg_formula(extra_generation_distance);
|
|
|
|
}
|
2018-07-19 22:04:23 +00:00
|
|
|
else if(argis("-quantum")) {
|
|
|
|
cheat();
|
|
|
|
quantum = true;
|
|
|
|
}
|
2021-04-11 20:15:40 +00:00
|
|
|
else if(argis("-lands")) {
|
2019-05-27 05:17:39 +00:00
|
|
|
PHASEFROM(2);
|
|
|
|
cheat();
|
|
|
|
stop_game();
|
2021-04-11 20:15:40 +00:00
|
|
|
shift(); land_structure = (eLandStructure) (argi());
|
2019-05-27 05:17:39 +00:00
|
|
|
}
|
2018-07-19 22:04:23 +00:00
|
|
|
else if(argis("-fix")) {
|
|
|
|
PHASE(1);
|
|
|
|
fixseed = true; autocheat = true;
|
|
|
|
}
|
2020-07-07 19:25:27 +00:00
|
|
|
else if(argis("-cellnames")) {
|
|
|
|
cheat(); debug_cellnames = true;
|
|
|
|
}
|
2018-07-19 22:04:23 +00:00
|
|
|
else if(argis("-fixx")) {
|
|
|
|
PHASE(1);
|
|
|
|
fixseed = true; autocheat = true;
|
|
|
|
shift(); startseed = argi();
|
|
|
|
}
|
2021-02-23 04:33:48 +00:00
|
|
|
else if(argis("-reseed")) {
|
|
|
|
PHASEFROM(2);
|
|
|
|
shift(); shrand(argi());
|
|
|
|
}
|
2018-07-19 22:04:23 +00:00
|
|
|
else if(argis("-steplimit")) {
|
|
|
|
fixseed = true; autocheat = true;
|
|
|
|
shift(); steplimit = argi();
|
|
|
|
}
|
2019-10-28 16:18:59 +00:00
|
|
|
else if(argis("-dgl")) {
|
2020-07-03 12:42:33 +00:00
|
|
|
#if CAP_GL
|
2019-10-28 16:24:25 +00:00
|
|
|
glhr::debug_gl = true;
|
2020-07-03 12:42:33 +00:00
|
|
|
#endif
|
2019-10-28 16:18:59 +00:00
|
|
|
}
|
2020-02-13 10:08:39 +00:00
|
|
|
else if(argis("-mgen-off")) {
|
|
|
|
PHASEFROM(3);
|
|
|
|
cheat();
|
|
|
|
gen_wandering = false;
|
|
|
|
}
|
2022-04-22 23:00:59 +00:00
|
|
|
else if(argis("-canvasfloor")) {
|
|
|
|
shift(); canvasfloor = argi();
|
|
|
|
for(int i=0; i<caflEND; i++) if(appears(mapeditor::canvasFloorName(i), args()))
|
|
|
|
canvasfloor = i;
|
|
|
|
}
|
2022-04-26 11:27:09 +00:00
|
|
|
else if(argis("-keys")) {
|
|
|
|
shift(); string s = args();
|
|
|
|
bool quote = false;
|
|
|
|
for(char c: s)
|
|
|
|
if(quote) {
|
|
|
|
quote = false;
|
|
|
|
if(c == '\\') dialog::queue_key(c), quote = false;
|
|
|
|
else if(c >= '1' && c <= '9') dialog::queue_key(SDLK_F1 + c - '1');
|
|
|
|
else if(c == 'e') dialog::queue_key(SDLK_ESCAPE);
|
|
|
|
else if(c == 'r') dialog::queue_key(SDLK_RETURN);
|
|
|
|
else if(c == 't') dialog::queue_key(SDLK_TAB);
|
|
|
|
else if(c == 'b') dialog::queue_key(SDLK_BACKSPACE);
|
|
|
|
else if(c == 'R') dialog::queue_key(SDLK_RIGHT);
|
|
|
|
else if(c == 'L') dialog::queue_key(SDLK_LEFT);
|
|
|
|
else if(c == 'U') dialog::queue_key(SDLK_UP);
|
|
|
|
else if(c == 'D') dialog::queue_key(SDLK_DOWN);
|
|
|
|
else if(c == 'H') dialog::queue_key(SDLK_HOME);
|
|
|
|
else if(c == 'E') dialog::queue_key(SDLK_END);
|
|
|
|
else if(c == 'P') dialog::queue_key(SDLK_PAGEUP);
|
|
|
|
else if(c == 'Q') dialog::queue_key(SDLK_PAGEDOWN);
|
|
|
|
}
|
|
|
|
else if(c == '\\') quote = true;
|
|
|
|
else dialog::queue_key(c);
|
|
|
|
}
|
2020-10-11 23:26:17 +00:00
|
|
|
else if(argis("-hroll")) {
|
|
|
|
shift();
|
|
|
|
int i = argi();
|
|
|
|
while(i>0) i--, hrand(10);
|
|
|
|
}
|
2018-07-19 22:04:23 +00:00
|
|
|
else if(argis("-W")) {
|
|
|
|
PHASEFROM(2);
|
|
|
|
shift();
|
|
|
|
firstland0 = firstland = specialland = readland(args());
|
2021-07-15 00:47:32 +00:00
|
|
|
if (!landUnlocked(firstland))
|
|
|
|
cheat();
|
2018-07-19 22:04:23 +00:00
|
|
|
stop_game_and_switch_mode(rg::nothing);
|
|
|
|
showstartmenu = false;
|
|
|
|
}
|
|
|
|
else return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto ah_cheat = addHook(hooks_args, 0, read_cheat_args);
|
|
|
|
#endif
|
|
|
|
|
2019-11-29 14:37:24 +00:00
|
|
|
EX bool ldebug = false;
|
|
|
|
|
|
|
|
EX void breakhere() {
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
2018-06-10 23:58:31 +00:00
|
|
|
}
|