mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-10 15:59:53 +00:00
more header cleanup
This commit is contained in:
parent
b0f2e7b6b9
commit
a0fcdb0c54
91
complex.cpp
91
complex.cpp
@ -468,19 +468,40 @@ namespace elec {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
EX namespace princess {
|
||||
|
||||
#if HDR
|
||||
#define EPX 39
|
||||
#define EPY 21
|
||||
|
||||
#define OUT_OF_PRISON 200
|
||||
#define OUT_OF_PALACE 250
|
||||
#define PRADIUS0 (141)
|
||||
#define PRADIUS1 (150)
|
||||
|
||||
struct info {
|
||||
int id; // id of this info
|
||||
cell *prison; // where was the Princess locked
|
||||
heptagon *alt; // alt of the prison
|
||||
int bestdist; // best dist achieved
|
||||
int bestnear; // best dist achieved, by the player
|
||||
int value; // number of Rugs at 120
|
||||
cell *princess; // where is the Princess currently
|
||||
};
|
||||
|
||||
namespace princess {
|
||||
#endif
|
||||
|
||||
bool generating = false;
|
||||
bool challenge = false;
|
||||
bool saved = false;
|
||||
bool everSaved = false;
|
||||
EX bool generating = false;
|
||||
EX bool challenge = false;
|
||||
EX bool saved = false;
|
||||
EX bool everSaved = false;
|
||||
|
||||
bool forceVizier = false;
|
||||
bool forceMouse = false;
|
||||
bool gotoPrincess = false;
|
||||
bool nodungeon = false;
|
||||
EX bool forceVizier = false;
|
||||
EX bool forceMouse = false;
|
||||
EX bool gotoPrincess = false;
|
||||
EX bool nodungeon = false;
|
||||
bool squeaked = false;
|
||||
|
||||
int saveHP = 0, saveArmedHP = 0;
|
||||
@ -493,7 +514,7 @@ namespace princess {
|
||||
if(i->alt) i->alt->emeraldval = i->id;
|
||||
}
|
||||
|
||||
int newInfo(cell *c) {
|
||||
EX int newInfo(cell *c) {
|
||||
info *i = new info;
|
||||
i->prison = c;
|
||||
i->princess = c;
|
||||
@ -739,13 +760,20 @@ namespace princess {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
EX }
|
||||
|
||||
namespace clearing {
|
||||
EX namespace clearing {
|
||||
|
||||
bool buggyplant = false;
|
||||
#if HDR
|
||||
struct clearingdata {
|
||||
cell *root;
|
||||
int dist;
|
||||
};
|
||||
#endif
|
||||
|
||||
std::map<heptagon*, clearingdata> bpdata;
|
||||
EX bool buggyplant = false;
|
||||
|
||||
EX std::map<heptagon*, clearingdata> bpdata;
|
||||
|
||||
cell *current_root;
|
||||
|
||||
@ -920,7 +948,7 @@ namespace clearing {
|
||||
steps--; ds++;
|
||||
}
|
||||
}
|
||||
}
|
||||
EX }
|
||||
|
||||
namespace whirlpool {
|
||||
|
||||
@ -2359,7 +2387,7 @@ void livecaves() {
|
||||
|
||||
/* evolver */
|
||||
|
||||
namespace tortoise {
|
||||
EX namespace tortoise {
|
||||
map<cell*, int> emap;
|
||||
map<cell*, int> babymap;
|
||||
int last;
|
||||
@ -2390,10 +2418,10 @@ namespace tortoise {
|
||||
|
||||
int getBit(int bits, int id) { return (bits >> id) & 1; }
|
||||
|
||||
int getRandomBits() { return hrand(1 << numbits); }
|
||||
EX int getRandomBits() { return hrand(1 << numbits); }
|
||||
|
||||
bool seek() { return items[itBabyTortoise] % 5; }
|
||||
int seekbits;
|
||||
EX int seekbits;
|
||||
double seekval[numbits];
|
||||
double currval[numbits];
|
||||
|
||||
@ -2438,7 +2466,7 @@ namespace tortoise {
|
||||
string measure(int bits) {
|
||||
return "(" + its(progress(bits)) + "/" + its(tortoise::numbits) + ")";
|
||||
}
|
||||
}
|
||||
EX }
|
||||
|
||||
namespace dragon {
|
||||
|
||||
@ -2622,11 +2650,18 @@ namespace dragon {
|
||||
|
||||
}
|
||||
|
||||
namespace sword {
|
||||
EX namespace sword {
|
||||
|
||||
#if HDR
|
||||
struct sworddir {
|
||||
int angle;
|
||||
transmatrix T;
|
||||
};
|
||||
#endif
|
||||
|
||||
int sword_angles;
|
||||
|
||||
array<sworddir, MAXPLAYER> dir;
|
||||
EX array<sworddir, MAXPLAYER> dir;
|
||||
|
||||
void possible_divisor(int s) { sword_angles *= s / gcd(sword_angles, s); }
|
||||
|
||||
@ -2656,7 +2691,7 @@ namespace sword {
|
||||
return c->move(s);
|
||||
}
|
||||
|
||||
cell *pos(cell *c, const sworddir& sd, bool rev) {
|
||||
EX cell *pos(cell *c, const sworddir& sd, bool rev) {
|
||||
if(WDIM == 2)
|
||||
return pos2(c, sd.angle + (rev ? sword_angles/2 : 0));
|
||||
else {
|
||||
@ -2678,7 +2713,7 @@ namespace sword {
|
||||
return pos(playerpos(id), dir[id], rev);
|
||||
}
|
||||
|
||||
bool at(cell *where, bool noplayer) {
|
||||
EX bool at(cell *where, bool noplayer IS(false)) {
|
||||
if(noplayer) return false;
|
||||
if(!orbcount(0) && !orbcount(1)) return false;
|
||||
for(int i=0; i<numplayers(); i++) if(multi::playerActive(i)) for(int b=0; b<2; b++)
|
||||
@ -2693,7 +2728,7 @@ namespace sword {
|
||||
}
|
||||
|
||||
// from c1 to c2
|
||||
sworddir shift(cell *c1, cell *c2, sworddir d) {
|
||||
EX sworddir shift(cell *c1, cell *c2, sworddir d) {
|
||||
if(!c1 || !c2) return d;
|
||||
int s1 = neighborId(c1, c2);
|
||||
int s2 = neighborId(c2, c1);
|
||||
@ -2738,7 +2773,7 @@ namespace sword {
|
||||
void shuffle() {
|
||||
for(int i=0; i<MAXPLAYER; i++) shuffle(i);
|
||||
}
|
||||
};
|
||||
EX }
|
||||
|
||||
namespace kraken {
|
||||
|
||||
@ -3427,7 +3462,7 @@ namespace windmap {
|
||||
|
||||
// Halloween namespace
|
||||
|
||||
namespace halloween {
|
||||
EX namespace halloween {
|
||||
cell *dragoncells[4];
|
||||
vector<cell*> srch;
|
||||
|
||||
@ -3505,7 +3540,7 @@ namespace halloween {
|
||||
c->stuntime = 2;
|
||||
}
|
||||
|
||||
void getTreat(cell *where) {
|
||||
EX void getTreat(cell *where) {
|
||||
if(!items[itTreat]) reset();
|
||||
gainItem(itTreat);
|
||||
farempty()->item = itTreat;
|
||||
@ -3668,7 +3703,7 @@ namespace halloween {
|
||||
items[itOrbShell] += 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
EX }
|
||||
|
||||
// ... also includes the Ivory Tower
|
||||
|
||||
|
31
game.cpp
31
game.cpp
@ -1185,6 +1185,19 @@ EX bool canAttack(cell *c1, eMonster m1, cell *c2, eMonster m2, flagtype flags)
|
||||
return true;
|
||||
}
|
||||
|
||||
#if HDR
|
||||
struct stalemate1 {
|
||||
eMonster who;
|
||||
cell *moveto;
|
||||
cell *killed;
|
||||
cell *pushto;
|
||||
cell *comefrom;
|
||||
cell *swordlast[2], *swordtransit[2], *swordnext[2];
|
||||
bool isKilled(cell *c);
|
||||
stalemate1(eMonster w, cell *mt, cell *ki, cell *pt, cell *cf) : who(w), moveto(mt), killed(ki), pushto(pt), comefrom(cf) {}
|
||||
};
|
||||
#endif
|
||||
|
||||
bool stalemate1::isKilled(cell *w) {
|
||||
if(w->monst == moNone || w == killed) return true;
|
||||
if(!moveto) return false;
|
||||
@ -1235,12 +1248,14 @@ bool stalemate1::isKilled(cell *w) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool stalemate::isKilled(cell *w) {
|
||||
EX namespace stalemate {
|
||||
EX bool isKilled(cell *w) {
|
||||
for(int f=0; f<isize(moves); f++)
|
||||
if(moves[f].isKilled(w)) return true;
|
||||
|
||||
return false;
|
||||
};
|
||||
EX }
|
||||
|
||||
EX bool isNeighbor(cell *c1, cell *c2) {
|
||||
for(int i=0; i<c1->type; i++) if(c1->move(i) == c2) return true;
|
||||
@ -1290,25 +1305,25 @@ EX vector<cell*> gun_targets(cell *c) {
|
||||
return cl.lst;
|
||||
}
|
||||
|
||||
namespace stalemate {
|
||||
vector<stalemate1> moves;
|
||||
bool nextturn;
|
||||
EX namespace stalemate {
|
||||
EX vector<stalemate1> moves;
|
||||
EX bool nextturn;
|
||||
|
||||
bool isMoveto(cell *c) {
|
||||
EX bool isMoveto(cell *c) {
|
||||
for(int i=0; i<isize(moves); i++) if(moves[i].moveto == c) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isKilledDirectlyAt(cell *c) {
|
||||
EX bool isKilledDirectlyAt(cell *c) {
|
||||
for(int i=0; i<isize(moves); i++) if(moves[i].killed == c) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isPushto(cell *c) {
|
||||
EX bool isPushto(cell *c) {
|
||||
for(int i=0; i<isize(moves); i++) if(moves[i].pushto == c) return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
EX }
|
||||
|
||||
bool onboat(stalemate1& sm) {
|
||||
cell *c = sm.moveto;
|
||||
|
128
hyper.h
128
hyper.h
@ -1033,50 +1033,8 @@ template<class T> struct dynamicval {
|
||||
~dynamicval() { where = backup; }
|
||||
};
|
||||
|
||||
struct stalemate1 {
|
||||
eMonster who;
|
||||
cell *moveto;
|
||||
cell *killed;
|
||||
cell *pushto;
|
||||
cell *comefrom;
|
||||
cell *swordlast[2], *swordtransit[2], *swordnext[2];
|
||||
bool isKilled(cell *c);
|
||||
stalemate1(eMonster w, cell *mt, cell *ki, cell *pt, cell *cf) : who(w), moveto(mt), killed(ki), pushto(pt), comefrom(cf) {}
|
||||
};
|
||||
|
||||
namespace stalemate {
|
||||
extern vector<stalemate1> moves;
|
||||
extern bool nextturn;
|
||||
|
||||
bool isKilled(cell *c);
|
||||
|
||||
bool isMoveto(cell *c);
|
||||
bool isKilledDirectlyAt(cell *c);
|
||||
bool isPushto(cell *c);
|
||||
};
|
||||
|
||||
namespace tortoise {
|
||||
extern int seekbits;
|
||||
int getRandomBits();
|
||||
}
|
||||
|
||||
static const int MAXPLAYER = 7;
|
||||
|
||||
namespace sword {
|
||||
|
||||
struct sworddir {
|
||||
int angle;
|
||||
transmatrix T;
|
||||
};
|
||||
|
||||
extern array<sworddir, MAXPLAYER> dir;
|
||||
|
||||
cell *pos(cell *c, const sworddir& sd, bool rev);
|
||||
cell *pos(int id);
|
||||
bool at(cell *where, bool noplayer = false);
|
||||
sworddir shift(cell *c1, cell *c2, sworddir);
|
||||
}
|
||||
|
||||
#define DEFAULTCONTROL (multi::players == 1 && !shmup::on && !multi::alwaysuse && !(rug::rugged && rug::renderonce))
|
||||
#define DEFAULTNOR(sym) (DEFAULTCONTROL || multi::notremapped(sym))
|
||||
|
||||
@ -1090,40 +1048,6 @@ namespace sword {
|
||||
#define displayfrZH dialog::zoom::displayfr_highlight
|
||||
#endif
|
||||
|
||||
namespace shot {
|
||||
#if CAP_SHOT
|
||||
extern int shotx, shoty, shotformat;
|
||||
extern bool make_svg;
|
||||
extern ld gamma, fade;
|
||||
extern string caption;
|
||||
extern bool transparent;
|
||||
void menu();
|
||||
void default_screenshot_content();
|
||||
void take(string fname, const function<void()>& what = default_screenshot_content);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if CAP_SVG
|
||||
namespace svg {
|
||||
void circle(int x, int y, int size, color_t col, color_t fillcolor, double linewidth);
|
||||
void polygon(int *polyx, int *polyy, int polyi, color_t col, color_t outline, double linewidth);
|
||||
void text(int x, int y, int size, const string& str, bool frame, color_t col, int align);
|
||||
extern bool in;
|
||||
extern string link;
|
||||
#if CAP_SHOT
|
||||
void render(const string& fname, const function<void()>& what = shot::default_screenshot_content);
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
namespace svg {
|
||||
static const always_false in;
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace halloween {
|
||||
void getTreat(cell *where);
|
||||
}
|
||||
|
||||
// just in case if I change my mind about when Orbs lose their power
|
||||
#define ORBBASE 0
|
||||
|
||||
@ -1221,14 +1145,6 @@ extern eGravity gravity_state, last_gravity_state;
|
||||
|
||||
#define IFM(x) (mousing?"":x)
|
||||
|
||||
namespace quotientspace {
|
||||
void build();
|
||||
void clear();
|
||||
extern vector<int> connections;
|
||||
}
|
||||
|
||||
void killFriendlyIvy();
|
||||
|
||||
#if CAP_SHAPES
|
||||
void pushdown(cell *c, int& q, const transmatrix &V, double down, bool rezoom, bool repriority);
|
||||
#endif
|
||||
@ -1691,50 +1607,6 @@ const eLand NOWALLSEP_USED = laWhirlpool;
|
||||
#define HAUNTED_RADIUS getDistLimit()
|
||||
#define UNKNOWN 65535
|
||||
|
||||
namespace clearing {
|
||||
|
||||
struct clearingdata {
|
||||
cell *root;
|
||||
int dist;
|
||||
};
|
||||
|
||||
extern bool buggyplant;
|
||||
|
||||
extern std::map<heptagon*, clearingdata> bpdata;
|
||||
}
|
||||
|
||||
namespace princess {
|
||||
#define EPX 39
|
||||
#define EPY 21
|
||||
|
||||
#define OUT_OF_PRISON 200
|
||||
#define OUT_OF_PALACE 250
|
||||
#define PRADIUS0 (141)
|
||||
#define PRADIUS1 (150)
|
||||
|
||||
extern bool generating;
|
||||
extern bool gotoPrincess;
|
||||
extern bool forceMouse;
|
||||
extern bool challenge;
|
||||
extern bool squeaked;
|
||||
extern bool saved;
|
||||
extern bool nodungeon;
|
||||
extern int reviveAt;
|
||||
extern bool forceVizier;
|
||||
|
||||
struct info {
|
||||
int id; // id of this info
|
||||
cell *prison; // where was the Princess locked
|
||||
heptagon *alt; // alt of the prison
|
||||
int bestdist; // best dist achieved
|
||||
int bestnear; // best dist achieved, by the player
|
||||
int value; // number of Rugs at 120
|
||||
cell *princess; // where is the Princess currently
|
||||
};
|
||||
|
||||
int newInfo(cell *c);
|
||||
}
|
||||
|
||||
#define GRAIL_FOUND 0x4000
|
||||
#define GRAIL_RADIUS_MASK 0x3FFF
|
||||
|
||||
|
@ -5,7 +5,7 @@ namespace hr {
|
||||
|
||||
// --- quotient geometry ---
|
||||
|
||||
namespace quotientspace {
|
||||
EX namespace quotientspace {
|
||||
struct code {
|
||||
int c[MAX_EDGE+1];
|
||||
};
|
||||
|
@ -5,16 +5,20 @@ namespace hr {
|
||||
|
||||
bool hide_hud = true;
|
||||
|
||||
#if HDR
|
||||
namespace shot { void default_screenshot_content(); }
|
||||
#endif
|
||||
|
||||
#if CAP_SVG
|
||||
// svg renderer
|
||||
namespace svg {
|
||||
EX namespace svg {
|
||||
#if ISWEB
|
||||
shstream f;
|
||||
#else
|
||||
fhstream f;
|
||||
#endif
|
||||
|
||||
bool in = false;
|
||||
EX bool in = false;
|
||||
|
||||
ld cta(color_t col) {
|
||||
// col >>= 24;
|
||||
@ -70,7 +74,7 @@ namespace svg {
|
||||
return buf;
|
||||
}
|
||||
|
||||
void circle(int x, int y, int size, color_t col, color_t fillcol, double linewidth) {
|
||||
EX void circle(int x, int y, int size, color_t col, color_t fillcol, double linewidth) {
|
||||
if(!invisible(col) || !invisible(fillcol)) {
|
||||
if(vid.stretch == 1)
|
||||
println(f, "<circle cx='", coord(x), "' cy='", coord(y), "' r='", coord(size), "' ", stylestr(fillcol, col, linewidth), "/>");
|
||||
@ -79,7 +83,7 @@ namespace svg {
|
||||
}
|
||||
}
|
||||
|
||||
string link;
|
||||
EX string link;
|
||||
|
||||
void startstring() {
|
||||
if(link != "") print(f, "<a xlink:href=\"", link, "\" xlink:show=\"replace\">");
|
||||
@ -91,7 +95,7 @@ namespace svg {
|
||||
|
||||
string font = "Times";
|
||||
|
||||
void text(int x, int y, int size, const string& str, bool frame, color_t col, int align) {
|
||||
EX void text(int x, int y, int size, const string& str, bool frame, color_t col, int align) {
|
||||
|
||||
double dfc = (x - current_display->xcenter) * (x - current_display->xcenter) +
|
||||
(y - current_display->ycenter) * (y - current_display->ycenter);
|
||||
@ -132,7 +136,7 @@ namespace svg {
|
||||
}
|
||||
}
|
||||
|
||||
void polygon(int *polyx, int *polyy, int polyi, color_t col, color_t outline, double linewidth) {
|
||||
EX void polygon(int *polyx, int *polyy, int polyi, color_t col, color_t outline, double linewidth) {
|
||||
|
||||
if(invisible(col) && invisible(outline)) return;
|
||||
if(polyi < 2) return;
|
||||
@ -151,7 +155,7 @@ namespace svg {
|
||||
println(f);
|
||||
}
|
||||
|
||||
void render(const string& fname, const function<void()>& what) {
|
||||
EX void render(const string& fname, const function<void()>& what IS(shot::default_screenshot_content)) {
|
||||
dynamicval<bool> v2(in, true);
|
||||
dynamicval<bool> v3(vid.usingGL, false);
|
||||
|
||||
@ -206,7 +210,7 @@ int read_args() {
|
||||
|
||||
auto ah = addHook(hooks_args, 0, read_args);
|
||||
#endif
|
||||
}
|
||||
EX }
|
||||
#endif
|
||||
|
||||
#if CAP_PNG
|
||||
@ -218,17 +222,18 @@ void IMAGESAVE(SDL_Surface *s, const char *fname) {
|
||||
#endif
|
||||
|
||||
#if CAP_SHOT
|
||||
namespace shot {
|
||||
EX namespace shot {
|
||||
|
||||
purehookset hooks_hqshot;
|
||||
|
||||
int shotx = 2000, shoty = 2000;
|
||||
bool make_svg = false;
|
||||
bool transparent = true;
|
||||
ld gamma = 1;
|
||||
int shotformat = -1;
|
||||
EX int shotx = 2000;
|
||||
EX int shoty = 2000;
|
||||
EX bool make_svg = false;
|
||||
EX bool transparent = true;
|
||||
EX ld gamma = 1;
|
||||
EX int shotformat = -1;
|
||||
string caption;
|
||||
ld fade = 1;
|
||||
EX ld fade = 1;
|
||||
|
||||
void set_shotx() {
|
||||
if(shotformat == -1) return;
|
||||
@ -245,7 +250,7 @@ void set_shotx() {
|
||||
int shot_aa = 1;
|
||||
#endif
|
||||
|
||||
void default_screenshot_content() {
|
||||
EX void default_screenshot_content() {
|
||||
#if CAP_RUG
|
||||
if(rug::rugged) {
|
||||
if(rug::in_crystal()) rug::physics();
|
||||
@ -299,7 +304,7 @@ void postprocess(string fname, SDL_Surface *sdark, SDL_Surface *sbright) {
|
||||
}
|
||||
#endif
|
||||
|
||||
void take(string fname, const function<void()>& what) {
|
||||
EX void take(string fname, const function<void()>& what IS(default_screenshot_content)) {
|
||||
|
||||
if(cheater) doOvergenerate();
|
||||
|
||||
@ -395,7 +400,7 @@ int png_read_args() {
|
||||
auto ah_png = addHook(hooks_args, 0, png_read_args);
|
||||
#endif
|
||||
|
||||
void menu() {
|
||||
EX void menu() {
|
||||
cmode = sm::SIDE;
|
||||
gamescreen(0);
|
||||
if(!CAP_SVG) make_svg = false;
|
||||
@ -468,7 +473,7 @@ void menu() {
|
||||
dialog::display();
|
||||
}
|
||||
|
||||
}
|
||||
EX }
|
||||
#endif
|
||||
|
||||
#if CAP_ANIMATIONS
|
||||
|
Loading…
Reference in New Issue
Block a user