1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-27 14:37:16 +00:00

further cleanup

This commit is contained in:
Zeno Rogue 2019-08-10 02:16:48 +02:00
parent 609d1b91d3
commit ad03115097
13 changed files with 210 additions and 281 deletions

View File

@ -971,6 +971,19 @@ EX bool displaychr(int x, int y, int shift, int size, char chr, color_t col) {
} }
#endif #endif
#if HDR
struct msginfo {
int stamp;
time_t rtstamp;
int gtstamp;
int turnstamp;
char flashout;
char spamtype;
int quantity;
string msg;
};
#endif
vector<msginfo> msgs; vector<msginfo> msgs;
vector<msginfo> gamelog; vector<msginfo> gamelog;

View File

@ -6,8 +6,8 @@ namespace hr {
#if CAP_COMMANDLINE #if CAP_COMMANDLINE
EX const char *scorefile = "hyperrogue.log"; EX const char *scorefile = "hyperrogue.log";
namespace arg { EX namespace arg {
eLand readland(const string& ss) { EX eLand readland(const string& ss) {
if(ss == "II") return laCrossroads2; if(ss == "II") return laCrossroads2;
if(ss == "III") return laCrossroads3; if(ss == "III") return laCrossroads3;
if(ss == "IV") return laCrossroads4; if(ss == "IV") return laCrossroads4;
@ -19,7 +19,7 @@ eLand readland(const string& ss) {
return laNone; return laNone;
} }
eItem readItem(const string& ss) { EX eItem readItem(const string& ss) {
for(int i=0; i<ittypes; i++) if(appears(iinf[i].name, ss)) { for(int i=0; i<ittypes; i++) if(appears(iinf[i].name, ss)) {
return eItem(i); return eItem(i);
break; break;
@ -27,14 +27,14 @@ eItem readItem(const string& ss) {
return itNone; return itNone;
} }
eMonster readMonster(const string& ss) { EX eMonster readMonster(const string& ss) {
for(int i=0; i<motypes; i++) if(appears(minf[i].name, ss)) { for(int i=0; i<motypes; i++) if(appears(minf[i].name, ss)) {
return eMonster(i); return eMonster(i);
break; break;
} }
return moNone; return moNone;
} }
} EX }
EX void initializeCLI() { EX void initializeCLI() {
printf("HyperRogue by Zeno Rogue <zeno@attnam.com>, version " VER "\n"); printf("HyperRogue by Zeno Rogue <zeno@attnam.com>, version " VER "\n");
@ -55,36 +55,60 @@ EX void initializeCLI() {
#endif #endif
} }
namespace arg { EX namespace arg {
vector<string> argument; EX int curphase;
int pos;
void lshift() { pos++; } vector<string> argument;
EX int pos;
EX void lshift() { pos++; }
void unshift() { pos--; } void unshift() { pos--; }
void shift() { EX void shift() {
lshift(); if(pos >= isize(argument)) { printf("Missing parameter\n"); exit(1); } lshift(); if(pos >= isize(argument)) { printf("Missing parameter\n"); exit(1); }
} }
bool nomore() { return pos >= isize(argument); } EX bool nomore() { return pos >= isize(argument); }
const string& args() { return argument[pos]; } EX const string& args() { return argument[pos]; }
const char* argcs() { return args().c_str(); } EX const char* argcs() { return args().c_str(); }
int argi() { return atoi(argcs()); } EX int argi() { return atoi(argcs()); }
unsigned arghex() { return strtoll(argcs(), NULL, 16); } EX unsigned arghex() { return strtoll(argcs(), NULL, 16); }
ld argf() { return parseld(args()); } EX ld argf() { return parseld(args()); }
bool argis(const string& s) { if(args()[0] == '-' && args()[1] == '-') return args().substr(1) == s; return args() == s; } EX bool argis(const string& s) { if(args()[0] == '-' && args()[1] == '-') return args().substr(1) == s; return args() == s; }
void init(int argc, char **argv) { for(int i=0; i<argc; i++) argument.push_back(argv[i]); lshift(); } EX void shift_arg_formula(ld& x, const reaction_t& r IS(reaction_t())) {
shift(); x = argf();
#if CAP_ANIMATIONS
anims::animate_parameter(x, args(), r);
#endif
}
#if HDR
// an useful macro
#define PHASE(x) { if(arg::curphase > x) arg::phaseerror(x); else if(arg::curphase < x) return 2; }
#define PHASEFROM(x) { if(arg::curphase < x) return 2; }
#define TOGGLE(x, param, act) \
else if(args()[0] == '-' && args()[1] == x && !args()[2]) { PHASEFROM(2); showstartmenu = false; act; } \
else if(args()[0] == '-' && args()[1] == x && args()[2] == '1') { PHASEFROM(2); showstartmenu = false; if(!param) act; } \
else if(args()[0] == '-' && args()[1] == x && args()[2] == '0') { PHASEFROM(2); showstartmenu = false; if(param) act; }
#endif
EX void cheat() { autocheat = true; cheater++; timerghost = false; }
EX void init(int argc, char **argv) { for(int i=0; i<argc; i++) argument.push_back(argv[i]); lshift(); }
void phaseerror(int x) { EX void phaseerror(int x) {
printf("Command line error: cannot read command '%s' from phase %d in phase %d\n", args().c_str(), x, curphase); printf("Command line error: cannot read command '%s' from phase %d in phase %d\n", args().c_str(), x, curphase);
exit(1); exit(1);
} }
bool dialog_launched = false; bool dialog_launched = false;
void launch_dialog(const reaction_t& r) { EX void launch_dialog(const reaction_t& r IS(reaction_t())) {
if(!dialog_launched) { if(!dialog_launched) {
popScreenAll(); popScreenAll();
showstartmenu = false; showstartmenu = false;
@ -93,7 +117,10 @@ namespace arg {
if(r) pushScreen(r); if(r) pushScreen(r);
} }
} EX int readCommon();
EX int readLocal();
EX void read(int phase);
EX }
int arg::readCommon() { int arg::readCommon() {
@ -282,7 +309,6 @@ EX purehookset hooks_config;
EX hookset<int()> *hooks_args; EX hookset<int()> *hooks_args;
namespace arg { namespace arg {
int curphase;
auto ah = addHook(hooks_args, 0, readCommon); auto ah = addHook(hooks_args, 0, readCommon);

View File

@ -4,6 +4,106 @@
namespace hr { namespace hr {
#if HDR
struct supersaver {
string name;
virtual string save() = 0;
virtual void load(const string& s) = 0;
virtual bool dosave() = 0;
virtual void reset() = 0;
virtual ~supersaver() {};
};
typedef vector<shared_ptr<supersaver>> saverlist;
extern saverlist savers;
#if CAP_CONFIG
template<class T> struct dsaver : supersaver {
T& val;
T dft;
bool dosave() { return val != dft; }
void reset() { val = dft; }
dsaver(T& val) : val(val) { }
};
template<class T> struct saver : dsaver<T> {};
template<class T, class U, class V> void addsaver(T& i, U name, V dft) {
auto s = make_shared<saver<T>> (i);
s->dft = dft;
s->name = name;
savers.push_back(s);
}
template<class T> void addsaver(T& i, string name) {
addsaver(i, name, i);
}
template<class T> struct saverenum : supersaver {
T& val;
T dft;
bool dosave() { return val != dft; }
void reset() { val = dft; }
saverenum<T>(T& v) : val(v) { }
string save() { return its(int(val)); }
void load(const string& s) { val = (T) atoi(s.c_str()); }
};
template<class T, class U> void addsaverenum(T& i, U name, T dft) {
auto s = make_shared<saverenum<T>> (i);
s->dft = dft;
s->name = name;
savers.push_back(s);
}
template<class T, class U> void addsaverenum(T& i, U name) {
addsaverenum(i, name, i);
}
template<> struct saver<int> : dsaver<int> {
saver<int>(int& val) : dsaver<int>(val) { }
string save() { return its(val); }
void load(const string& s) { val = atoi(s.c_str()); }
};
template<> struct saver<char> : dsaver<char> {
saver<char>(char& val) : dsaver<char>(val) { }
string save() { return its(val); }
void load(const string& s) { val = atoi(s.c_str()); }
};
template<> struct saver<bool> : dsaver<bool> {
saver<bool>(bool& val) : dsaver<bool>(val) { }
string save() { return val ? "yes" : "no"; }
void load(const string& s) { val = isize(s) && s[0] == 'y'; }
};
template<> struct saver<unsigned> : dsaver<unsigned> {
saver<unsigned>(unsigned& val) : dsaver<unsigned>(val) { }
string save() { return itsh(val); }
void load(const string& s) { val = (unsigned) strtoll(s.c_str(), NULL, 16); }
};
template<> struct saver<string> : dsaver<string> {
saver<string>(string& val) : dsaver<string>(val) { }
string save() { return val; }
void load(const string& s) { val = s; }
};
template<> struct saver<ld> : dsaver<ld> {
saver<ld>(ld& val) : dsaver<ld>(val) { }
string save() { return fts(val, 10); }
void load(const string& s) {
if(s == "0.0000000000e+000") ; // ignore!
else val = atof(s.c_str());
}
};
#endif
#endif
EX ld bounded_mine_percentage = 0.1; EX ld bounded_mine_percentage = 0.1;
EX int bounded_mine_quantity, bounded_mine_max; EX int bounded_mine_quantity, bounded_mine_max;

View File

@ -253,7 +253,7 @@ EX void checkpanjoy(double t) {
#endif #endif
bool quitmainloop = false; EX bool quitmainloop = false;
EX bool doexiton(int sym, int uni) { EX bool doexiton(int sym, int uni) {
if(sym == SDLK_ESCAPE) return true; if(sym == SDLK_ESCAPE) return true;

View File

@ -16,7 +16,7 @@
namespace hr { namespace hr {
const char* COLORBAR = "###"; EX const char* COLORBAR = "###";
EX namespace dialog { EX namespace dialog {

View File

@ -112,7 +112,7 @@ EX int explore[10], exploreland[10][landtypes], landcount[landtypes];
EX map<modecode_t, array<int, ittypes> > hiitems; EX map<modecode_t, array<int, ittypes> > hiitems;
bool orbused[ittypes], lastorbused[ittypes]; bool orbused[ittypes], lastorbused[ittypes];
EX bool playermoved = true; // center on the PC? EX bool playermoved = true; // center on the PC?
bool flipplayer = true; // flip the player image after move, do not flip after attack EX bool flipplayer = true; // flip the player image after move, do not flip after attack
EX int cheater = 0; // did the player cheat? EX int cheater = 0; // did the player cheat?
int anthraxBonus = 0; // for using Safety in tactical Camelot int anthraxBonus = 0; // for using Safety in tactical Camelot
@ -415,7 +415,10 @@ EX int killtypes() {
return res; return res;
} }
eGravity gravity_state, last_gravity_state; #if HDR
enum eGravity { gsNormal, gsLevitation, gsAnti };
#endif
EX eGravity gravity_state, last_gravity_state;
bool bird_disruption(cell *c) { bool bird_disruption(cell *c) {
return c->cpdist <= 5 && items[itOrbGravity]; return c->cpdist <= 5 && items[itOrbGravity];
@ -8602,6 +8605,10 @@ EX bool movepcto(int d, int subdir IS(1), bool checkonly IS(false)) {
return true; return true;
} }
#if HDR
inline bool movepcto(const movedir& md) { return movepcto(md.d, md.subdir); }
#endif
/* bool isPsiTarget(cell *dst) { /* bool isPsiTarget(cell *dst) {
return return
dst->cpdist > 1 && dst->cpdist > 1 &&

View File

@ -447,7 +447,7 @@ void ge_select_tiling(const vector<eGeometry>& lst) {
dialog::display(); dialog::display();
} }
string current_proj_name() { EX string current_proj_name() {
if(pmodel != mdDisk || nonisotropic) if(pmodel != mdDisk || nonisotropic)
return models::get_model_name(pmodel); return models::get_model_name(pmodel);
else if(hyperbolic && vid.alpha == 1) else if(hyperbolic && vid.alpha == 1)

View File

@ -173,7 +173,7 @@ void buildHelpText() {
#endif #endif
} }
void buildCredits() { EX void buildCredits() {
help = ""; help = "";
help += XLAT("game design, programming, texts and graphics by Zeno Rogue <zeno@attnam.com>\n\n"); help += XLAT("game design, programming, texts and graphics by Zeno Rogue <zeno@attnam.com>\n\n");
if(lang() != 0) if(lang() != 0)

253
hyper.h
View File

@ -674,13 +674,6 @@ inline cellwalker operator+ (heptspin hs, cth_t) { return cellwalker(hs.at->c7,
// kill count for Graveyard/Hive // kill count for Graveyard/Hive
#define R100 (big_unlock ? 500 : 100) #define R100 (big_unlock ? 500 : 100)
string XLAT(string x); // translate the sentence x
string XLATN(string x); // translate the sentence x
string cts(char c); // character to string
string its(int i); // int to string
string itsh8(int i); // int to string (8 hex digits)
string itsh(int i); // int to string
// size casted to int, to prevent warnings and actual errors caused by the unsignedness of x.size() // size casted to int, to prevent warnings and actual errors caused by the unsignedness of x.size()
template<class T> int isize(const T& x) {return x.size(); } template<class T> int isize(const T& x) {return x.size(); }
@ -689,33 +682,6 @@ template<class T> int isize(const T& x) {return x.size(); }
namespace anticheat { extern bool tampered; } namespace anticheat { extern bool tampered; }
#define HRANDMAX 0x7FFFFFFF #define HRANDMAX 0x7FFFFFFF
namespace rg {
// possible parameters e.g. for restart_game and wrongmode
static const char nothing = 0;
static const char peace = 'P';
static const char inv = 'i';
static const char chaos = 'C';
static const char tactic = 't';
static const char tour = 'T';
static const char yendor = 'y';
static const char shmup = 's';
static const char randpattern = 'r';
static const char princess = 'p';
static const char daily = 'd';
static const char daily_off = 'D';
static const char racing = 'R';
static const char dualmode = 'U';
// wrongmode only -- marks 'global' achievements not related to the current mode
static const char global = 'x';
// wrongmode only -- change vid.scfg.players then restart_game(rg::nothing) instead
static const char multi = 'm';
// wrongmode only -- mark achievements for special geometries/variations
static const char special_geometry = 'g';
}
enum orbAction { roMouse, roKeyboard, roCheck, roMouseForce, roMultiCheck, roMultiGo };
namespace hive { void createBugArmy(cell *c); } namespace hive { void createBugArmy(cell *c); }
namespace whirlpool { void generate(cell *wto); } namespace whirlpool { void generate(cell *wto); }
namespace whirlwind { void generate(cell *wto); } namespace whirlwind { void generate(cell *wto); }
@ -740,15 +706,8 @@ struct movedir {
cell *tgt; // for MD_USE_ORB: target cell cell *tgt; // for MD_USE_ORB: target cell
}; };
void activateActiv(cell *c, bool msg);
// shmup // shmup
string csname(charstyle& cs);
void initcs(charstyle& cs);
extern bool flipplayer;
template<class T> class hookset : public map<int, function<T>> {}; template<class T> class hookset : public map<int, function<T>> {};
typedef hookset<void()> *purehookset; typedef hookset<void()> *purehookset;
@ -972,106 +931,20 @@ inline int operator - (PPR x, PPR y) { return int(x) - int(y); }
#define OUTLINE_FORE ((forecolor << 8) + 0xFF) #define OUTLINE_FORE ((forecolor << 8) + 0xFF)
#define OUTLINE_BACK ((backcolor << 8) + 0xFF) #define OUTLINE_BACK ((backcolor << 8) + 0xFF)
inline string pick123() { return cts('1' + rand() % 3); }
inline string pick12() { return cts('1' + rand() % 2); }
extern int detaillevel;
extern bool quitmainloop;
enum eGravity { gsNormal, gsLevitation, gsAnti };
extern eGravity gravity_state, last_gravity_state;
#define IFM(x) (mousing?"":x) #define IFM(x) (mousing?"":x)
extern bool viewdists; enum orbAction { roMouse, roKeyboard, roCheck, roMouseForce, roMultiCheck, roMultiGo };
void preventbarriers(cell *c);
bool passable_for(eMonster m, cell *w, cell *from, flagtype extra);
void beastcrash(cell *c, cell *beast);
int angledist(int t, int d1, int d2);
int angledist(cell *c, int d1, int d2);
void setcameraangle(bool b);
#define MODELCOUNT ((int) mdGUARD) #define MODELCOUNT ((int) mdGUARD)
void drawShape(pair<ld,ld>* coords, int qty, color_t color); void drawShape(pair<ld,ld>* coords, int qty, color_t color);
#define pmodel (vid.vpmodel) #define pmodel (vid.vpmodel)
string current_proj_name();
inline bool mdAzimuthalEqui() { return among(pmodel, mdEquidistant, mdEquiarea, mdEquivolume); }
inline bool mdBandAny() { return among(pmodel, mdBand, mdBandEquidistant, mdBandEquiarea, mdSinusoidal); }
color_t darkena(color_t c, int lev, int a); color_t darkena(color_t c, int lev, int a);
#define SHSIZE 16 #define SHSIZE 16
namespace anims { void animate_parameter(ld &x, string f, const reaction_t& r); }
extern bool timerghost;
extern bool autocheat;
extern int cheater;
namespace arg {
#if CAP_COMMANDLINE
void lshift();
void unshift();
void shift();
const string& args();
const char* argcs();
int argi();
ld argf();
bool argis(const string& s);
bool nomore();
unsigned arghex();
inline void shift_arg_formula(ld& x, const reaction_t& r = reaction_t()) { shift(); x = argf();
#if CAP_ANIMATIONS
anims::animate_parameter(x, args(), r);
#endif
}
void init(int _argc, char **_argv);
void launch_dialog(const reaction_t& r = reaction_t());
extern int curphase;
void phaseerror(int x);
// returned values: 0 = ok, 1 = not recognized, 2 = shift phase
int readCommon();
int readLocal();
// an useful macro
#define PHASE(x) { if(arg::curphase > x) arg::phaseerror(x); else if(arg::curphase < x) return 2; }
#define PHASEFROM(x) { if(arg::curphase < x) return 2; }
inline void cheat() { autocheat = true; cheater++; timerghost = false; }
#define TOGGLE(x, param, act) \
else if(args()[0] == '-' && args()[1] == x && !args()[2]) { PHASEFROM(2); showstartmenu = false; act; } \
else if(args()[0] == '-' && args()[1] == x && args()[2] == '1') { PHASEFROM(2); showstartmenu = false; if(!param) act; } \
else if(args()[0] == '-' && args()[1] == x && args()[2] == '0') { PHASEFROM(2); showstartmenu = false; if(param) act; }
void read(int phase);
eLand readland(const string& ss);
eItem readItem(const string& ss);
eMonster readMonster(const string& ss);
#endif
}
#if CAP_TOUR #if CAP_TOUR
namespace tour { namespace tour {
extern bool on; extern bool on;
@ -1228,25 +1101,7 @@ template<class T, class V, class... U> V callhandlers(V zero, hookset<T> *h, U&.
return zero; return zero;
} }
struct msginfo { string XLAT(string);
int stamp;
time_t rtstamp;
int gtstamp;
int turnstamp;
char flashout;
char spamtype;
int quantity;
string msg;
};
int watercolor(int phase);
bool doHighlight();
void buildHelpText();
void buildCredits();
void setAppropriateOverview();
bool quitsaves();
extern const char* COLORBAR;
#define GLERR(call) glError(call, __FILE__, __LINE__) #define GLERR(call) glError(call, __FILE__, __LINE__)
@ -1503,107 +1358,6 @@ template<class T> array<T, 4> make_array(T a, T b, T c, T d) { array<T,4> x; x[0
template<class T> array<T, 3> make_array(T a, T b, T c) { array<T,3> x; x[0] = a; x[1] = b; x[2] = c; return x; } template<class T> array<T, 3> make_array(T a, T b, T c) { array<T,3> x; x[0] = a; x[1] = b; x[2] = c; return x; }
template<class T> array<T, 2> make_array(T a, T b) { array<T,2> x; x[0] = a; x[1] = b; return x; } template<class T> array<T, 2> make_array(T a, T b) { array<T,2> x; x[0] = a; x[1] = b; return x; }
struct supersaver {
string name;
virtual string save() = 0;
virtual void load(const string& s) = 0;
virtual bool dosave() = 0;
virtual void reset() = 0;
virtual ~supersaver() {};
};
typedef vector<shared_ptr<supersaver>> saverlist;
extern saverlist savers;
#if CAP_CONFIG
template<class T> struct dsaver : supersaver {
T& val;
T dft;
bool dosave() { return val != dft; }
void reset() { val = dft; }
dsaver(T& val) : val(val) { }
};
template<class T> struct saver : dsaver<T> {};
template<class T, class U, class V> void addsaver(T& i, U name, V dft) {
auto s = make_shared<saver<T>> (i);
s->dft = dft;
s->name = name;
savers.push_back(s);
}
template<class T> void addsaver(T& i, string name) {
addsaver(i, name, i);
}
template<class T> struct saverenum : supersaver {
T& val;
T dft;
bool dosave() { return val != dft; }
void reset() { val = dft; }
saverenum<T>(T& v) : val(v) { }
string save() { return its(int(val)); }
void load(const string& s) { val = (T) atoi(s.c_str()); }
};
template<class T, class U> void addsaverenum(T& i, U name, T dft) {
auto s = make_shared<saverenum<T>> (i);
s->dft = dft;
s->name = name;
savers.push_back(s);
}
template<class T, class U> void addsaverenum(T& i, U name) {
addsaverenum(i, name, i);
}
template<> struct saver<int> : dsaver<int> {
saver<int>(int& val) : dsaver<int>(val) { }
string save() { return its(val); }
void load(const string& s) { val = atoi(s.c_str()); }
};
template<> struct saver<char> : dsaver<char> {
saver<char>(char& val) : dsaver<char>(val) { }
string save() { return its(val); }
void load(const string& s) { val = atoi(s.c_str()); }
};
template<> struct saver<bool> : dsaver<bool> {
saver<bool>(bool& val) : dsaver<bool>(val) { }
string save() { return val ? "yes" : "no"; }
void load(const string& s) { val = isize(s) && s[0] == 'y'; }
};
template<> struct saver<unsigned> : dsaver<unsigned> {
saver<unsigned>(unsigned& val) : dsaver<unsigned>(val) { }
string save() { return itsh(val); }
void load(const string& s) { val = (unsigned) strtoll(s.c_str(), NULL, 16); }
};
template<> struct saver<string> : dsaver<string> {
saver<string>(string& val) : dsaver<string>(val) { }
string save() { return val; }
void load(const string& s) { val = s; }
};
string fts(ld val, int prec);
string itsh(int x);
template<> struct saver<ld> : dsaver<ld> {
saver<ld>(ld& val) : dsaver<ld>(val) { }
string save() { return fts(val, 10); }
void load(const string& s) {
if(s == "0.0000000000e+000") ; // ignore!
else val = atof(s.c_str());
}
};
#endif
namespace daily { namespace daily {
extern bool on; extern bool on;
extern int daily_id; extern int daily_id;
@ -1736,6 +1490,3 @@ static const color_t NOCOLOR = 0;
#define IS(z) #define IS(z)
#define EX #define EX
namespace hr {
inline bool movepcto(const movedir& md) { return movepcto(md.d, md.subdir); }
}

View File

@ -96,6 +96,11 @@ EX namespace polygonal {
pair<ld, ld> compute(ld x, ld y) { return compute(x,y,deg); } pair<ld, ld> compute(ld x, ld y) { return compute(x,y,deg); }
EX } EX }
#if HDR
inline bool mdAzimuthalEqui() { return among(pmodel, mdEquidistant, mdEquiarea, mdEquivolume); }
inline bool mdBandAny() { return among(pmodel, mdBand, mdBandEquidistant, mdBandEquiarea, mdSinusoidal); }
#endif
EX namespace models { EX namespace models {
EX string formula = "z^2"; EX string formula = "z^2";

View File

@ -3,7 +3,7 @@
namespace hr { namespace hr {
bool quitsaves() { return (items[itOrbSafety] && CAP_SAVE && !archimedean); } EX bool quitsaves() { return (items[itOrbSafety] && CAP_SAVE && !archimedean); }
EX bool needConfirmationEvenIfSaved() { EX bool needConfirmationEvenIfSaved() {
return canmove && (gold() >= 30 || tkills() >= 50) && !cheater; return canmove && (gold() >= 30 || tkills() >= 50) && !cheater;

View File

@ -82,7 +82,7 @@ struct monster {
using namespace multi; using namespace multi;
eItem targetRangedOrbKey(orbAction a); eItem targetRangedOrbKey(enum orbAction a);
eItem keyresult[MAXPLAYER]; eItem keyresult[MAXPLAYER];
ld fabsl(ld x) { return x>0?x:-x; } ld fabsl(ld x) { return x>0?x:-x; }

View File

@ -6,6 +6,33 @@
namespace hr { namespace hr {
#if HDR
namespace rg {
// possible parameters e.g. for restart_game and wrongmode
static const char nothing = 0;
static const char peace = 'P';
static const char inv = 'i';
static const char chaos = 'C';
static const char tactic = 't';
static const char tour = 'T';
static const char yendor = 'y';
static const char shmup = 's';
static const char randpattern = 'r';
static const char princess = 'p';
static const char daily = 'd';
static const char daily_off = 'D';
static const char racing = 'R';
static const char dualmode = 'U';
// wrongmode only -- marks 'global' achievements not related to the current mode
static const char global = 'x';
// wrongmode only -- change vid.scfg.players then restart_game(rg::nothing) instead
static const char multi = 'm';
// wrongmode only -- mark achievements for special geometries/variations
static const char special_geometry = 'g';
}
#endif
EX bool game_active; EX bool game_active;
EX bool cblind; EX bool cblind;