#if CAP_COMMANDLINE const char *scorefile = "hyperrogue.log"; const char *conffile = "hyperrogue.ini"; string levelfile = "hyperrogue.lev"; string picfile = "hyperrogue.pic"; const char *musicfile = ""; const char *loadlevel = NULL; eLand readland(const char *s) { string ss = s; if(ss == "II") return laCrossroads2; if(ss == "III") return laCrossroads3; if(ss == "IV") return laCrossroads4; if(ss == "V") return laCrossroads5; for(int l=0; l, version " VER "\n"); #ifndef NOLICENSE printf("released under GNU General Public License version 2 and thus\n"); printf("comes with absolutely no warranty; see COPYING for details\n"); #endif #ifdef FHS static string sbuf, cbuf; if(getenv("HOME")) { sbuf = getenv("HOME"); sbuf += "/."; sbuf += scorefile; cbuf = getenv("HOME"); cbuf += "/."; cbuf += conffile; scorefile = sbuf.c_str(); conffile = cbuf.c_str(); } #endif } int arg::readCommon() { if(argis("-c")) { PHASE(1); shift(); conffile = args(); } else if(argis("-s")) { PHASE(1); shift(); scorefile = args(); } else if(argis("-m")) { PHASE(1); shift(); musicfile = args(); } #if CAP_SDLAUDIO else if(argis("-se")) { PHASE(1); shift(); wheresounds = args(); } #endif #if CAP_EDIT else if(argis("-lev")) { shift(); levelfile = args(); } else if(argis("-pic")) { shift(); picfile = args(); } else if(argis("-load")) { PHASE(3); shift(); mapstream::loadMap(args()); } else if(argis("-picload")) { PHASE(3); shift(); mapeditor::loadPicFile(args()); } #endif else if(argis("-canvas")) { firstland = specialland = laCanvas; shift(); if(args()[1] == 0) patterns::whichCanvas = args()[0]; else patterns::canvasback = strtol(args(), NULL, 16); } else if(argis("-noplayer")) mapeditor::drawplayer = !mapeditor::drawplayer; else if(argis("-pattern")) { PHASE(3); shift(); char *c = args(); using namespace patterns; subpattern_flags = 0; while(*c) { if(*c >= '0' && *c <= '9') subpattern_flags ^= (*c - '0'); else whichPattern = *c; c++; } } else if(argis("-back")) { shift(); backcolor = strtol(args(), NULL, 16); } else if(argis("-borders")) { shift(); bordcolor = strtol(args(), NULL, 16); } else if(argis("-fore")) { shift(); forecolor = strtol(args(), NULL, 16); } else if(argis("-W2")) { shift(); cheatdest = readland(args()); autocheat = true; showstartmenu = false; } else if(argis("-W")) { shift(); firstland0 = firstland = specialland = readland(args()); autocheat = true; showstartmenu = false; } else if(argis("-I")) { PHASE(3) cheater++; timerghost = false; shift(); eItem i = readItem(args()); shift(); items[i] = argi(); } else if(argis("-IP")) { PHASE(3) cheater++; timerghost = false; shift(); eItem i = readItem(args()); shift(); int q = argi(); placeItems(q, i); } else if(argis("-ambush")) { // make all ambushes use the given number of dogs // example: hyper -W Hunt -IP Shield 1 -ambush 60 PHASE(3) cheater++; timerghost = false; shift(); ambushval = argi(); } else if(argis("-M")) { PHASE(3) cheater++; timerghost = false; shift(); eMonster m = readMonster(args()); shift(); int q = argi(); printf("m = %s q = %d\n", dnameof(m), q); restoreGolems(q, m, 7); } else if(argis("-L")) { printf("Treasures:\n"); for(int i=1; i - fieldpattern: quotient by the given (must be followed by qpar)\n"); printf(" -qpar - fieldpattern: use the given prime instead of 43\n"); printf(" -cs - fieldpattern: set subpath to the given (cannot be followed by qpar)\n"); printf(" -csp - fieldpattern: find the subpath of order (cannot be followed by qpar)\n"); printf(" -S* - toggle Shmup\n"); printf(" -P n - switch Shmup number of players (n=1..7)\n"); printf(" -PM - switch the model index\n"); printf(" -H* - toggle Hardcore\n"); printf(" -T* - toggle Tactical\n"); printf(" -7* - toggle heptagonal mode\n"); printf(" -C* - toggle Chaos mode\n"); printf(" -R* - toggle Random Pattern\n"); printf(" -Y id - enable Yendor, level id\n"); printf(" -D - disable all the special game modes\n"); printf(" -L - list of features\n"); printf(" -debugf 7 - output debugging information to hyperrogue-debug.txt\n"); printf(" -debuge 7 - output debugging information to stderr\n"); printf(" -offline - don't connect to Steam (for Steam versions)\n"); printf(" -I ITEM n - start with n of ITEM (activates cheat and disables ghosts)\n"); printf(" -fix - fix the seed\n"); printf("Toggles: -o0 disables, -o1 enables, -o switches"); printf("Not all options are documented, see hyper.cpp"); exit(0); } else if(ca::readArg()) ; else return 1; return 0; } purehookset hooks_config; hookset *hooks_args; namespace arg { int argc; char **argv; int curphase; auto ah = addHook(hooks_args, 0, readCommon); void read(int phase) { curphase = phase; callhooks(hooks_config); while(argc) { for(auto& h: *hooks_args) { int r = h.second(); if(r == 2) return; if(r == 0) { lshift(); goto cont; } } printf("Unknown option: %s\n", args()); exit(3); cont: ; } } } #endif