mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-02-01 03:39:16 +00:00
brief fixup
This commit is contained in:
parent
920f26e1e7
commit
6feec1307f
70
system.cpp
70
system.cpp
@ -36,16 +36,16 @@ namespace rg {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** is a game map currently loaded (it is false after hr::stop_game and true after hr::start_game) */
|
/** \brief is a game map currently loaded (it is false after hr::stop_game and true after hr::start_game) */
|
||||||
EX bool game_active;
|
EX bool game_active;
|
||||||
|
|
||||||
/** God mode */
|
/** \brief God mode */
|
||||||
EX bool autocheat;
|
EX bool autocheat;
|
||||||
|
|
||||||
/** which wall should we fill the Canvas with */
|
/** \brief which wall should we fill the Canvas with */
|
||||||
EX eWall canvas_default_wall = waNone;
|
EX eWall canvas_default_wall = waNone;
|
||||||
|
|
||||||
/** the number of Black Lotuses collected -- but updated only if we manage to escape */
|
/** \brief the number of Black Lotuses collected -- but updated only if we manage to escape */
|
||||||
EX int truelotus;
|
EX int truelotus;
|
||||||
|
|
||||||
EX int asteroids_generated, asteroid_orbs_generated;
|
EX int asteroids_generated, asteroid_orbs_generated;
|
||||||
@ -59,7 +59,7 @@ EX bool gamegen_failure;
|
|||||||
|
|
||||||
EX eLand top_land;
|
EX eLand top_land;
|
||||||
|
|
||||||
/** a comparator for version number strings */
|
/** \brief a comparator for version number strings */
|
||||||
EX bool verless(string v, string cmp) {
|
EX bool verless(string v, string cmp) {
|
||||||
if(isdigit(v[0]) && isdigit(v[1]))
|
if(isdigit(v[0]) && isdigit(v[1]))
|
||||||
v = "A" + v;
|
v = "A" + v;
|
||||||
@ -68,17 +68,17 @@ EX bool verless(string v, string cmp) {
|
|||||||
return v < cmp;
|
return v < cmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** should we set the starting land to specialland */
|
/** \brief should we set the starting land to specialland */
|
||||||
bool do_use_special_land() {
|
bool do_use_special_land() {
|
||||||
return
|
return
|
||||||
!safety &&
|
!safety &&
|
||||||
(peace::on || tactic::on || geometry || NONSTDVAR || randomPatternsMode || yendor::on || racing::on);
|
(peace::on || tactic::on || geometry || NONSTDVAR || randomPatternsMode || yendor::on || racing::on);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Hooks for welcomeMessage. Return true to capture.. */
|
/** \brief Hooks for welcomeMessage. Return true to capture. */
|
||||||
EX hookset<bool()> *hooks_welcome_message;
|
EX hookset<bool()> *hooks_welcome_message;
|
||||||
|
|
||||||
/** Print the welcome message during the start of game. Depends on the current mode and other settings. */
|
/** \brief Print the welcome message during the start of game. Depends on the current mode and other settings. */
|
||||||
EX void welcomeMessage() {
|
EX void welcomeMessage() {
|
||||||
if(callhandlers(false, hooks_welcome_message)) return;
|
if(callhandlers(false, hooks_welcome_message)) return;
|
||||||
#if CAP_TOUR
|
#if CAP_TOUR
|
||||||
@ -143,10 +143,10 @@ EX void welcomeMessage() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/** These hooks are called at the start of initgame. */
|
/** \brief These hooks are called at the start of initgame. */
|
||||||
EX hookset<void()> *hooks_initgame;
|
EX hookset<void()> *hooks_initgame;
|
||||||
|
|
||||||
/** initialize the game */
|
/** \brief initialize the game */
|
||||||
EX void initgame() {
|
EX void initgame() {
|
||||||
DEBBI(DF_INIT, ("initGame"));
|
DEBBI(DF_INIT, ("initGame"));
|
||||||
callhooks(hooks_initgame);
|
callhooks(hooks_initgame);
|
||||||
@ -400,42 +400,42 @@ bool havesave = true;
|
|||||||
EX namespace scores {
|
EX namespace scores {
|
||||||
|
|
||||||
#if HDR
|
#if HDR
|
||||||
/** the amount of boxes reserved for each hr::score item */
|
/** \brief the amount of boxes reserved for each hr::score item */
|
||||||
#define MAXBOX 500
|
#define MAXBOX 500
|
||||||
/** currently used boxes in hr::score */
|
/** \brief currently used boxes in hr::score */
|
||||||
#define POSSCORE 387
|
#define POSSCORE 387
|
||||||
/** a struct to keep local score from an earlier game */
|
/** \brief a struct to keep local score from an earlier game */
|
||||||
struct score {
|
struct score {
|
||||||
/** version used */
|
/** \brief version used */
|
||||||
string ver;
|
string ver;
|
||||||
/** all the data of the saved score, see applyBoxes() */
|
/** \brief all the data of the saved score, see applyBoxes() */
|
||||||
int box[MAXBOX];
|
int box[MAXBOX];
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** the current save */
|
/** \brief the current save */
|
||||||
EX score save;
|
EX score save;
|
||||||
/** the index of the next box */
|
/** \brief the index of the next box */
|
||||||
EX int boxid;
|
EX int boxid;
|
||||||
|
|
||||||
/** see hr::applyBox */
|
/** \brief see hr::applyBox */
|
||||||
EX bool saving, loading, loadingHi;
|
EX bool saving, loading, loadingHi;
|
||||||
|
|
||||||
/** names of all the boxes */
|
/** \brief names of all the boxes */
|
||||||
EX string boxname[MAXBOX];
|
EX string boxname[MAXBOX];
|
||||||
/** 'fake' boxes should not appear when examining local scores */
|
/** \brief 'fake' boxes should not appear when examining local scores */
|
||||||
EX bool fakebox[MAXBOX];
|
EX bool fakebox[MAXBOX];
|
||||||
/** does this box contain monster kills */
|
/** \brief does this box contain monster kills */
|
||||||
EX bool monsbox[MAXBOX];
|
EX bool monsbox[MAXBOX];
|
||||||
|
|
||||||
/** the next box should contain t */
|
/** \brief the next box should contain t */
|
||||||
void applyBox(int& t) {
|
void applyBox(int& t) {
|
||||||
if(saving) save.box[boxid++] = t;
|
if(saving) save.box[boxid++] = t;
|
||||||
else if(loading) t = save.box[boxid++];
|
else if(loading) t = save.box[boxid++];
|
||||||
else boxid++;
|
else boxid++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** the next box should contain tb */
|
/** \brief the next box should contain tb */
|
||||||
void applyBoxBignum(bignum& tb) {
|
void applyBoxBignum(bignum& tb) {
|
||||||
float tf;
|
float tf;
|
||||||
int ti;
|
int ti;
|
||||||
@ -446,7 +446,7 @@ void applyBoxBignum(bignum& tb) {
|
|||||||
if(loading) tb = bignum(tf);
|
if(loading) tb = bignum(tf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** the next box should contain i, and possibly be named name */
|
/** \brief the next box should contain i, and possibly be named name */
|
||||||
EX void applyBoxNum(int& i, string name IS("")) {
|
EX void applyBoxNum(int& i, string name IS("")) {
|
||||||
fakebox[boxid] = (name == "");
|
fakebox[boxid] = (name == "");
|
||||||
boxname[boxid] = name;
|
boxname[boxid] = name;
|
||||||
@ -454,7 +454,7 @@ EX void applyBoxNum(int& i, string name IS("")) {
|
|||||||
applyBox(i);
|
applyBox(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** the next box should contain b, and possibly be named name */
|
/** \brief the next box should contain b, and possibly be named name */
|
||||||
void applyBoxBool(bool& b, string name = "") {
|
void applyBoxBool(bool& b, string name = "") {
|
||||||
int i = b;
|
int i = b;
|
||||||
applyBoxNum(i, name);
|
applyBoxNum(i, name);
|
||||||
@ -462,14 +462,14 @@ void applyBoxBool(bool& b, string name = "") {
|
|||||||
b = i;
|
b = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Save i while saving, do nothing while loading. Use together with hr::scores::applyBoxLoad and boxid++ */
|
/** \brief Save i while saving, do nothing while loading. Use together with hr::scores::applyBoxLoad and boxid++ */
|
||||||
void applyBoxSave(int i, string name = "") {
|
void applyBoxSave(int i, string name = "") {
|
||||||
fakebox[boxid] = (name == "");
|
fakebox[boxid] = (name == "");
|
||||||
boxname[boxid] = name;
|
boxname[boxid] = name;
|
||||||
applyBox(i);
|
applyBox(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Load i while loading, do nothing while saving. Use together with hr::scores::applyBoxSave and boxid++ */
|
/** \brief Load i while loading, do nothing while saving. Use together with hr::scores::applyBoxSave and boxid++ */
|
||||||
int applyBoxLoad(string name = "") {
|
int applyBoxLoad(string name = "") {
|
||||||
fakebox[boxid] = (name == "");
|
fakebox[boxid] = (name == "");
|
||||||
boxname[boxid] = name;
|
boxname[boxid] = name;
|
||||||
@ -477,7 +477,7 @@ int applyBoxLoad(string name = "") {
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** the next box is the number of collected items it */
|
/** \brief the next box is the number of collected items it */
|
||||||
void applyBoxI(eItem it, bool f = false) {
|
void applyBoxI(eItem it, bool f = false) {
|
||||||
boxname[boxid] = iinf[it].name;
|
boxname[boxid] = iinf[it].name;
|
||||||
fakebox[boxid] = f;
|
fakebox[boxid] = f;
|
||||||
@ -494,13 +494,13 @@ void addinv(eItem it) {
|
|||||||
invorb.push_back(it);
|
invorb.push_back(it);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Handle the information about orb it. Need to call list_invorb later */
|
/** \brief Handle the information about orb it. Need to call list_invorb later */
|
||||||
void applyBoxOrb(eItem it) {
|
void applyBoxOrb(eItem it) {
|
||||||
applyBoxI(it, true);
|
applyBoxI(it, true);
|
||||||
invorb.push_back(it);
|
invorb.push_back(it);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Handle the OSM information for all orbs that applyBoxOrb has been called for so far */
|
/** \brief Handle the OSM information for all orbs that applyBoxOrb has been called for so far */
|
||||||
void list_invorb() {
|
void list_invorb() {
|
||||||
for(eItem it: invorb) {
|
for(eItem it: invorb) {
|
||||||
#if CAP_INV
|
#if CAP_INV
|
||||||
@ -515,7 +515,7 @@ void list_invorb() {
|
|||||||
invorb.clear();
|
invorb.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** handle the number of monsters of type m killed */
|
/** \brief handle the number of monsters of type m killed */
|
||||||
void applyBoxM(eMonster m, bool f = false) {
|
void applyBoxM(eMonster m, bool f = false) {
|
||||||
fakebox[boxid] = f;
|
fakebox[boxid] = f;
|
||||||
boxname[boxid] = minf[m].name;
|
boxname[boxid] = minf[m].name;
|
||||||
@ -523,7 +523,7 @@ void applyBoxM(eMonster m, bool f = false) {
|
|||||||
applyBox(kills[m]);
|
applyBox(kills[m]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Call applyBox for all the required values. This will save the values if hr::scores::saving==true, load if hr::scores::loading==true, load into highscores if hr::scores::loadingHi==true */
|
/** \brief Call applyBox for all the required values. This will save the values if hr::scores::saving==true, load if hr::scores::loading==true, load into highscores if hr::scores::loadingHi==true */
|
||||||
EX void applyBoxes() {
|
EX void applyBoxes() {
|
||||||
invorb.clear();
|
invorb.clear();
|
||||||
|
|
||||||
@ -875,18 +875,18 @@ EX void applyBoxes() {
|
|||||||
if(isize(invorb)) { println(hlog, "ERROR: Orbs not taken into account"); exit(1); }
|
if(isize(invorb)) { println(hlog, "ERROR: Orbs not taken into account"); exit(1); }
|
||||||
}
|
}
|
||||||
|
|
||||||
/** save the current game values to save */
|
/** \brief save the current game values to save */
|
||||||
EX void saveBox() {
|
EX void saveBox() {
|
||||||
boxid = 0; saving = true; applyBoxes(); saving = false;
|
boxid = 0; saving = true; applyBoxes(); saving = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** load the current game values from save */
|
/** \brief load the current game values from save */
|
||||||
void loadBox() {
|
void loadBox() {
|
||||||
// have boxid
|
// have boxid
|
||||||
boxid = 0; loading = true; applyBoxes(); loading = false;
|
boxid = 0; loading = true; applyBoxes(); loading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** load the current game values from save into the highscore tables */
|
/** \brief load the current game values from save into the highscore tables */
|
||||||
void loadBoxHigh() {
|
void loadBoxHigh() {
|
||||||
|
|
||||||
dynamicval<int> sp1(multi::players, save.box[197]);
|
dynamicval<int> sp1(multi::players, save.box[197]);
|
||||||
|
Loading…
Reference in New Issue
Block a user