export everything: modules compiled separately

This commit is contained in:
Zeno Rogue 2019-09-06 08:17:02 +02:00
parent e96d24e8c2
commit 848eb8f48b
47 changed files with 268 additions and 236 deletions

View File

@ -21,9 +21,9 @@ ld eyepos;
hyperpoint shcenter;
hyperpoint front_leg, rear_leg;
transmatrix front_leg_move, rear_leg_move, front_leg_move_inverse, rear_leg_move_inverse;
ld leg_length;
EX hyperpoint front_leg, rear_leg;
EX transmatrix front_leg_move, rear_leg_move, front_leg_move_inverse, rear_leg_move_inverse;
EX ld leg_length;
vector<hyperpoint> geometry_information::get_shape(hpcshape sh) {
vector<hyperpoint> res;
@ -43,7 +43,7 @@ hyperpoint get_center(const vector<hyperpoint>& vh) {
return normalize_flat(h);
}
ld zc(ld z) {
EX ld zc(ld z) {
if(WDIM == 2 && GDIM == 3)
return geom3::lev_to_factor(cgi.human_height * z);
return cgi.human_height * (z - 0.5) * revZ;
@ -787,7 +787,7 @@ void geometry_information::shift_last_straight(ld z) {
for(int i=last->s; i<isize(hpc); i++) hpc[i] = zpush(z) * hpc[i];
}
void queueball(const transmatrix& V, ld rad, color_t col, eItem what) {
EX void queueball(const transmatrix& V, ld rad, color_t col, eItem what) {
if(what == itOrbSpeed) {
transmatrix V1 = V * cspin(1, 2, M_PI/2);
ld tt = ptick(100);

View File

@ -1056,7 +1056,7 @@ archimedean_tiling edited;
bool symbol_editing;
void next_variation() {
EX void next_variation() {
set_variation(
PURE ? eVariation::dual :
DUAL ? eVariation::bitruncated :

View File

@ -107,7 +107,7 @@ bool eqs(const char* x, const char* y) {
return *y? *x==*y?eqs(x+1,y+1):false:true;
}
int getnext(const char* s, int& i) {
EX int getnext(const char* s, int& i) {
int siz = utfsize(s[i]);
// if(fontdeb) printf("s=%s i=%d siz=%d\n", s, i, siz);
@ -128,7 +128,7 @@ TTF_Font *font[256];
EX SDL_Surface *s;
EX SDL_Surface *s_screen;
color_t qpixel_pixel_outside;
EX color_t qpixel_pixel_outside;
EX color_t& qpixel(SDL_Surface *surf, int x, int y) {
if(x<0 || y<0 || x >= surf->w || y >= surf->h) return qpixel_pixel_outside;
@ -142,7 +142,7 @@ EX color_t& qpixel(SDL_Surface *surf, int x, int y) {
#if CAP_SDLTTF
string fontpath = ISWEB ? "sans-serif" : HYPERPATH "DejaVuSans-Bold.ttf";
EX string fontpath = ISWEB ? "sans-serif" : HYPERPATH "DejaVuSans-Bold.ttf";
void loadfont(int siz) {
if(!font[siz]) {
@ -245,7 +245,7 @@ EX void start_projection(int ed, bool perspective) {
glhr::projection_multiply(glhr::translate(tx, -ty, 0));
}
void eyewidth_translate(int ed) {
EX void eyewidth_translate(int ed) {
if(ed) glhr::projection_multiply(glhr::translate(-ed * current_display->eyewidth(), 0, 0));
}
@ -1000,9 +1000,9 @@ struct msginfo {
};
#endif
vector<msginfo> msgs;
EX vector<msginfo> msgs;
vector<msginfo> gamelog;
EX vector<msginfo> gamelog;
EX void flashMessages() {
for(int i=0; i<isize(msgs); i++)
@ -1012,7 +1012,7 @@ EX void flashMessages() {
}
}
string fullmsg(msginfo& m) {
EX string fullmsg(msginfo& m) {
string s = m.msg;
if(m.quantity > 1) s += " (x" + its(m.quantity) + ")";
return s;
@ -1443,8 +1443,8 @@ EX int calcfps() {
EX namespace subscreens {
vector<display_data> player_displays;
bool in;
EX vector<display_data> player_displays;
EX bool in;
EX int current_player;
EX bool is_current_player(int id) {

View File

@ -11,6 +11,7 @@ namespace hr {
EX namespace binary {
#if CAP_BT
#if HDR
enum bindir {
bd_right = 0,
bd_up_right = 1,
@ -21,6 +22,7 @@ EX namespace binary {
bd_down_left = 5, /* for cells of degree 7 */
bd_down_right = 6 /* for cells of degree 7 */
};
#endif
EX int type_of(heptagon *h) {
return h->c7->type;

View File

@ -425,7 +425,7 @@ monstertype minf[motypes] = {
#include "content.cpp"
};
genderswitch_t genderswitch[NUM_GS] = {
EX genderswitch_t genderswitch[NUM_GS] = {
{ GEN_F, moFalsePrincess, "False Princess",
"Don't be fooled by this red-haired girl, or you will be stabbed if you come too close!"},
{ GEN_M, moFalsePrincess, "False Prince",

View File

@ -67,7 +67,7 @@ EX namespace arg {
EX int pos;
EX void lshift() { pos++; }
void unshift() { pos--; }
EX void unshift() { pos--; }
EX void shift() {
lshift(); if(pos >= isize(argument)) { printf("Missing parameter\n"); exit(1); }

View File

@ -53,7 +53,7 @@ EX namespace whirlwind {
}
cell *where;
int dfrom[2], dto[2];
EX int dfrom[2], dto[2];
EX int qdirs;
int gdist(int d, int e) { return dirdiff(d-e, where->type); }
@ -963,7 +963,7 @@ EX namespace whirlpool {
// next == +1 -> next
// next == -1 -> prev
cell *get(cell *c, int next) {
EX cell *get(cell *c, int next) {
int i = 0;
if(!eubinary && !c->master->alt) return NULL;
int d = celldistAlt(c);
@ -1319,7 +1319,7 @@ EX namespace mirror {
}
}
void createHere(cellwalker cw, int cpid) {
EX void createHere(cellwalker cw, int cpid) {
if(!cw.at) return;
if(cw.at->wall == waCloud)
createMirages(cw, cpid);
@ -1327,7 +1327,7 @@ EX namespace mirror {
createMirrors(cw, cpid);
}
void breakMirror(cellwalker cw, int pid) {
EX void breakMirror(cellwalker cw, int pid) {
if(!cw.at) return;
cell *c = cw.at;
if(c->wall == waMirror || c->wall == waCloud) {
@ -1434,7 +1434,7 @@ EX namespace mirror {
list();
}
int mirrordir(cell *c) {
EX int mirrordir(cell *c) {
if(c->type == 7) return c->bardir;
int icount = 0, isum = 0;
@ -1621,7 +1621,7 @@ EX namespace hive {
vector<cell*> deadbug;
vector<cell*> bugcellq;
int bugcount[BUGCOLORS];
EX int bugcount[BUGCOLORS];
bool isBugEnemy(cell *c, int k) {
if(isPlayerOn(c) && !invismove) return true;
@ -2438,7 +2438,7 @@ EX namespace tortoise {
return bi;
}
int getBit(int bits, int id) { return (bits >> id) & 1; }
EX int getBit(int bits, int id) { return (bits >> id) & 1; }
EX int getRandomBits() { return hrand(1 << numbits); }
@ -2455,7 +2455,7 @@ EX namespace tortoise {
else val = target;
}
void updateVals(int delta) {
EX void updateVals(int delta) {
int currbits = getBits(cwt.at);
for(int i=0; i<numbits; i++)
update(seekval[i], seek() && !(peace::on && !peace::hint) ? getBit(seekbits, i) : .5, delta);
@ -2463,7 +2463,7 @@ EX namespace tortoise {
update(currval[i], getBit(currbits, i), delta);
}
double getScent(int bits) {
EX double getScent(int bits) {
double res = 0;
for(int i=0; i<numbits; i++)
/* if(getBit(bits, i) != getBit(getBits(cwt.at), i))
@ -2540,7 +2540,7 @@ EX namespace dragon {
}
}
int bodypart(cell *c, cell *head) {
EX int bodypart(cell *c, cell *head) {
int i = 0, j = 0;
int maxlen = 1000;
while(maxlen-->0) {
@ -2685,7 +2685,7 @@ EX namespace sword {
#endif
int sword_angles;
EX int sword_angles;
EX array<sworddir, MAXPLAYER> dir;
@ -2706,7 +2706,7 @@ EX namespace sword {
}
}
cell *pos2(cell *c, int s) {
EX cell *pos2(cell *c, int s) {
int t = c->type;
if(hybri) t -= 2;
s *= 2;
@ -3081,7 +3081,7 @@ EX namespace prairie {
return 15^c->LHU.fi.rval;
}
cell *next(cell *c, int pv=1) {
EX cell *next(cell *c, int pv IS(1)) {
for(int i=0; i<c->type; i++) {
cell *c1 = createMov(c, i);
cell *c2 = createMov(c, (i+pv+c->type)%c->type);
@ -3384,7 +3384,7 @@ EX namespace windmap {
return id-1;
}
vector<unsigned char> windcodes;
EX vector<unsigned char> windcodes;
void wcheck(cell *a, cell *b) {
int i = getId(a);

View File

@ -112,7 +112,7 @@ EX namespace brownian {
recurse(c, FAT);
}
void init_further(cell *c) {
EX void init_further(cell *c) {
if(!hyperbolic) return;
int dl = getDistLimit();
dynamicval<bool> be(generatingEquidistant, true);
@ -177,7 +177,7 @@ EX namespace brownian {
EX colortable colors = { 0x603000, 0x804000, 0xA05000, 0xC09050, 0xE0D0A0 };
color_t get_color(int y) {
EX color_t get_color(int y) {
return
y < level ? gradient(colors[0], colors[1], 1, y, level-1) :
y < 2 * level ? colors[2] :
@ -214,7 +214,7 @@ EX namespace westwall {
placeLocalOrbs(c);
}
int coastvalEdge1(cell *c) {
EX int coastvalEdge1(cell *c) {
if(c->land == laWestWall && !c->landparam) buildEquidistant(c);
return coastvalEdge(c);
}

View File

@ -111,7 +111,7 @@ template<> struct saver<ld> : dsaver<ld> {
EX ld bounded_mine_percentage = 0.1;
EX int bounded_mine_quantity, bounded_mine_max;
const char *conffile = "hyperrogue.ini";
EX const char *conffile = "hyperrogue.ini";
EX array<ld, gGUARD> sightranges;
@ -141,7 +141,7 @@ struct charstyle_old {
bool lefthanded;
};
void hread(hstream& hs, charstyle& cs) {
EX void hread(hstream& hs, charstyle& cs) {
// before 0xA61A there was no eyecolor
if(hs.get_vernum() < 0xA61A) {
charstyle_old cso;
@ -159,7 +159,7 @@ void hread(hstream& hs, charstyle& cs) {
else hread_raw(hs, cs);
}
void hwrite(hstream& hs, const charstyle& cs) {
EX void hwrite(hstream& hs, const charstyle& cs) {
hwrite_raw(hs, cs);
}
@ -198,7 +198,7 @@ EX int lang() {
return default_language;
}
bool autojoy = true;
EX bool autojoy = true;
#if CAP_CONFIG
saverlist savers;
@ -214,7 +214,7 @@ template<class T, class U> void addsaverenum(T& i, U name) {}
template<class T, class U> void addsaverenum(T& i, U name, T dft) {}
#endif
void addsaver(charstyle& cs, string s) {
EX void addsaver(charstyle& cs, string s) {
addsaver(cs.charid, s + ".charid");
addsaver(cs.skincolor, s + ".skincolor");
addsaver(cs.eyecolor, s + ".eyecolor");

View File

@ -8,8 +8,8 @@
#include "hyper.h"
namespace hr {
int frames;
bool outoffocus = false;
EX int frames;
EX bool outoffocus = false;
EX int mousex, mousey;
EX hyperpoint mouseh, mouseoh;
@ -40,7 +40,7 @@ EX bool mousepressed = false;
EX bool mousemoved = false;
EX bool actonrelease = false;
bool mousepan, oldmousepan;
EX bool mousepan, oldmousepan;
#if CAP_MOUSEGRAB
EX ld mouseaim_x, mouseaim_y;
#endif
@ -57,9 +57,9 @@ EX movedir mousedest;
EX ld shiftmul = 1;
EX cell *mouseover, *mouseover2, *lmouseover;
ld modist, modist2, centdist;
EX ld modist, modist2, centdist;
int lastt;
EX int lastt;
EX bool mouseout() {
if((getcstat != '-' && getcstat) || (lgetcstat && lgetcstat != '-')) return true;
@ -1093,7 +1093,7 @@ EX bool handleCompass() {
// orientation sensitivity
EX namespace ors {
int mode;
EX int mode;
double sensitivity = 1;
int when_enabled;
@ -1204,11 +1204,11 @@ transmatrix change_geometry(const transmatrix& T) {
return U;
}
void unrotate(transmatrix& T) {
EX void unrotate(transmatrix& T) {
if(mode == 1) T = inverse(relative_matrix) * T;
}
void rerotate(transmatrix& T) {
EX void rerotate(transmatrix& T) {
if(mode == 1) T = (relative_matrix) * T;
}

View File

@ -1459,7 +1459,7 @@ void transform_euclid_to_crystal () {
if(pmodel == mdPerspective) pmodel = mdDisk;
}
void add_crystal_transform(char c) {
EX void add_crystal_transform(char c) {
if(shmup::on) return;
if(cryst && ginf[gCrystal].sides == 6) {
dialog::addItem("convert Crystal to 3D", c);

View File

@ -26,7 +26,7 @@ void limitgen(T... args) {
}
#endif
cell *pathTowards(cell *pf, cell *pt) {
EX cell *pathTowards(cell *pf, cell *pt) {
while(celldist(pt) > celldist(pf)) {
if(isNeighbor(pf, pt)) return pt;
@ -42,7 +42,7 @@ cell *pathTowards(cell *pf, cell *pt) {
bool errorReported = false;
void describeCell(cell *c) {
EX void describeCell(cell *c) {
if(!c) { printf("NULL\n"); return; }
printf("describe %p: ", c);
printf("%-15s", linf[c->land].name);
@ -93,14 +93,14 @@ eItem randomTreasure2(int cv) {
EX eLand cheatdest;
void cheatMoveTo(eLand l) {
EX void cheatMoveTo(eLand l) {
cheatdest = l;
if(l == laCrossroads5) l = laCrossroads;
activateSafety(l);
cheatdest = laNone;
}
bool applyCheat(char u, cell *c = NULL) {
EX bool applyCheat(char u, cell *c IS(NULL)) {
if(u == 'L') {
do {

View File

@ -111,7 +111,8 @@ EX namespace dialog {
if(ev.type == SDL_MOUSEBUTTONDOWN) initzoom();
if(ev.type == SDL_MOUSEBUTTONUP && zoomf > 1) stopzoom();
}
#else
#endif
#if !(CAP_MENUSCALING && CAP_SDL)
EX void handleZooming(SDL_Event &ev) {}
#endif
@ -341,7 +342,7 @@ EX namespace dialog {
EX int tothei, dialogwidth, dfsize, dfspace, leftwidth, rightwidth, innerwidth, itemx, keyx, valuex;
string highlight_text;
EX string highlight_text;
EX void measure() {
tothei = 0;

View File

@ -126,7 +126,7 @@ EX int shapes_merged;
color_t triangle_color, line_color;
vector<glvertex> triangle_vertices;
vector<glvertex> line_vertices;
void glapplymatrix(const transmatrix& V);
EX void glapplymatrix(const transmatrix& V);
#endif
EX void glflush() {
@ -475,7 +475,7 @@ void drawTexturedTriangle(SDL_Surface *s, int *px, int *py, glvertex *tv, color_
#if CAP_GL
void glapplymatrix(const transmatrix& V) {
EX void glapplymatrix(const transmatrix& V) {
GLfloat mat[16];
int id = 0;
@ -1746,11 +1746,13 @@ EX void drawqueue() {
}
}
#if HDR
template<class T, class... U> T& queuea(PPR prio, U... u) {
ptds.push_back(unique_ptr<T>(new T (u...)));
ptds.back()->prio = prio;
return (T&) *ptds.back();
}
#endif
#if CAP_SHAPES
EX dqi_poly& queuepolyat(const transmatrix& V, const hpcshape& h, color_t col, PPR prio) {

View File

@ -80,8 +80,8 @@ EX namespace torusconfig {
#endif
// new values to change
int newqty, newdy, newsdx, newsdy;
int torus_cx, torus_cy;
EX int newqty, newdy, newsdx, newsdy;
EX int torus_cx, torus_cy;
EX vector<torusmode_info> tmodes = {
{"single row (hex)", TF_SINGLE | TF_HEX},
@ -98,10 +98,10 @@ EX namespace torusconfig {
};
EX eTorusMode torus_mode;
eTorusMode newmode;
EX eTorusMode newmode;
EX flagtype tmflags() { return tmodes[torus_mode].flags; }
int getqty() {
EX int getqty() {
if(tmflags() & TF_SINGLE)
return qty;
else
@ -205,11 +205,11 @@ EX namespace torusconfig {
return 2 * (e1.first * e2.first + e1.second*e2.second) + (S3 == 3 ? e1.first*e2.second + e2.first * e1.second : 0);
}
int dcross(gp::loc e1, gp::loc e2) {
EX int dcross(gp::loc e1, gp::loc e2) {
return e1.first * e2.second - e1.second*e2.first;
}
gp::loc sdxy() { return gp::loc(sdx, sdy); }
EX gp::loc sdxy() { return gp::loc(sdx, sdy); }
EX int mobius_dir_basic() {
int dscalars[6];
@ -223,7 +223,7 @@ EX namespace torusconfig {
return -1;
}
bool mobius_symmetric(bool square, int dx, int dy) {
EX bool mobius_symmetric(bool square, int dx, int dy) {
dynamicval<eGeometry> g(geometry, square ? gEuclidSquare : gEuclid);
dynamicval<int> gx(sdx, dx);
dynamicval<int> gy(sdy, dy);
@ -305,7 +305,7 @@ EX namespace torusconfig {
}
EX }
int euclid_getvec(int dx, int dy) {
EX int euclid_getvec(int dx, int dy) {
if(euwrap) return torusconfig::getvec(dx, dy);
else return pair_to_vec(dx, dy);
}
@ -474,7 +474,7 @@ struct hrmap_euclidean : hrmap_euclid_any {
}
};
cellwalker vec_to_cellwalker(int vec) {
EX cellwalker vec_to_cellwalker(int vec) {
if(!fulltorus) {
auto p = euclideanAtCreate(vec);
if(p.second)
@ -771,7 +771,7 @@ EX namespace euclid3 {
return new hrmap_euclid3;
}
transmatrix move_matrix(cell *c, int i) {
EX transmatrix move_matrix(cell *c, int i) {
return cubemap()->get_move(c, i);
}
@ -1057,7 +1057,7 @@ EX namespace euclid3 {
return canonical_seq[canonical_hash[cat]];
}
void prepare_torus3() {
EX void prepare_torus3() {
T_edit = T0;
twisted_edit = twisted0;
}

View File

@ -624,7 +624,9 @@ EX namespace ts {
EX }
EX bool viewdists = false;
bool use_color_codes = true, use_analyzer = true, show_distance_lists = true;
EX bool use_color_codes = true;
EX bool use_analyzer = true;
EX bool show_distance_lists = true;
int first_distance = 0, scrolltime = 0;
bool scrolling_distances = false;
@ -638,7 +640,7 @@ color_t distribute_color(int id) {
return v;
}
void do_viewdist(cell *c, const transmatrix& V, color_t& wcol, color_t& fcol) {
EX void do_viewdist(cell *c, const transmatrix& V, color_t& wcol, color_t& fcol) {
if(behindsphere(V)) return;
int cd = (use_color_codes || number_coding == ncDistance || number_coding == ncDebug) ? curr_dist(c) : 0;
@ -680,7 +682,7 @@ void do_viewdist(cell *c, const transmatrix& V, color_t& wcol, color_t& fcol) {
queuestr(V, (isize(label) > 1 ? .6 : 1), label, 0xFF000000 + dc, 1);
}
void viewdist_configure_dialog() {
EX void viewdist_configure_dialog() {
dialog::init("");
cmode |= sm::SIDE | sm::MAYDARK | sm::EXPANSION;
gamescreen(0);
@ -832,7 +834,7 @@ void expansion_analyzer::view_distances_dialog() {
dialog::display();
}
void enable_viewdists() {
EX void enable_viewdists() {
first_distance = 0;
scrolltime = 0;
viewdists = true;

View File

@ -28,9 +28,6 @@ struct fgeomextra {
};
#endif
extern int subpathid;
extern int subpathorder;
bool isprime(int n) {
for(int k=2; k<n; k++) if(n%k == 0) return false;
return true;
@ -733,7 +730,7 @@ void fpattern::findsubpath() {
fpattern fp43(43);
void info() {
EX void info() {
fpattern fp(0);
int cases = 0, hard = 0;
for(int p=0; p<500; p++) {
@ -798,6 +795,10 @@ EX struct fpattern& getcurrfp() {
return fp_invalid;
}
// todo undefined behavior
EX int subpathid = currfp.matcode[currfp.strtomatrix("RRRPRRRRRPRRRP")];
EX int subpathorder = currfp.order(currfp.matrices[subpathid]);
// extra information for field quotient extra configuration
EX vector<fgeomextra> fgeomextras = {
@ -815,7 +816,7 @@ EX vector<fgeomextra> fgeomextras = {
EX int current_extra = 0;
void nextPrime(fgeomextra& ex) {
EX void nextPrime(fgeomextra& ex) {
dynamicval<eGeometry> g(geometry, ex.base);
int nextprime;
if(isize(ex.primes))
@ -835,7 +836,7 @@ void nextPrime(fgeomextra& ex) {
}
}
void nextPrimes(fgeomextra& ex) {
EX void nextPrimes(fgeomextra& ex) {
while(isize(ex.primes) < 4)
nextPrime(ex);
}

View File

@ -745,21 +745,21 @@ EX namespace gp {
qfloorinfo qfi;
void set_no_floor() {
EX void set_no_floor() {
qfi.fshape = NULL;
qfi.shape = NULL;
qfi.tinf = NULL;
qfi.usershape = -1;
}
void set_floor(floorshape& sh) {
EX void set_floor(floorshape& sh) {
qfi.fshape = &sh;
qfi.shape = NULL;
qfi.tinf = NULL;
qfi.usershape = -1;
}
void set_floor(hpcshape& sh) {
EX void set_floor(hpcshape& sh) {
qfi.shape = &sh;
qfi.fshape = NULL;
qfi.spin = Id;
@ -767,7 +767,7 @@ void set_floor(hpcshape& sh) {
qfi.usershape = -1;
}
void set_floor(const transmatrix& spin, hpcshape& sh) {
EX void set_floor(const transmatrix& spin, hpcshape& sh) {
qfi.shape = &sh;
qfi.fshape = NULL;
qfi.spin = spin;
@ -801,7 +801,7 @@ EX int shvid(cell *c) {
return ctof(c);
}
dqi_poly *draw_shapevec(cell *c, const transmatrix& V, const vector<hpcshape> &shv, color_t col, PPR prio = PPR::DEFAULT) {
EX struct dqi_poly *draw_shapevec(cell *c, const transmatrix& V, const vector<hpcshape> &shv, color_t col, PPR prio IS(PPR::DEFAULT)) {
if(!c) return &queuepolyat(V, shv[0], col, prio);
else if(WDIM == 3) return NULL;
#if CAP_GP
@ -837,7 +837,7 @@ dqi_poly *draw_shapevec(cell *c, const transmatrix& V, const vector<hpcshape> &s
return &queuepolyat(V, shv[shvid(c)], col, prio);
}
void draw_floorshape(cell *c, const transmatrix& V, const floorshape &fsh, color_t col, PPR prio = PPR::DEFAULT) {
EX void draw_floorshape(cell *c, const transmatrix& V, const floorshape &fsh, color_t col, PPR prio IS(PPR::DEFAULT)) {
draw_shapevec(c, V, fsh.b, col, prio);
}
@ -859,8 +859,8 @@ EX void draw_qfi(cell *c, const transmatrix& V, color_t col, PPR prio IS(PPR::DE
else draw_shapevec(c, V, (qfi.fshape->*tab), col, prio);
}
bool floorshape_debug;
void viewmat() {
EX bool floorshape_debug;
EX void viewmat() {
if(floorshape_debug) {
transmatrix V = ggmatrix(cwt.at);

View File

@ -106,7 +106,7 @@ EX void createNoise(int t) {
EX int currentLocalTreasure;
bool landvisited[landtypes];
EX bool landvisited[landtypes];
bool eq(short a, short b) { return a==b; }
@ -140,7 +140,7 @@ EX vector<cell*> offscreen;
EX vector<cell*> pathqm;
/** list of cells that the monsters are targetting (PCs, allies, Thumpers, etc.) */
vector<cell*> targets;
EX vector<cell*> targets;
/** monsters of specific types to move */
vector<cell*> worms, ivies, ghosts, golems, hexsnakes;
@ -175,7 +175,7 @@ EX inline bool singleused() { return !(shmup::on || multi::players > 1); }
*
* This ensures that the game should unfold exactly the same if given the same seed and the same input.
*/
std::mt19937 hrngen;
EX std::mt19937 hrngen;
/** initialize \link hrngen \endlink */
EX void shrand(int i) {
@ -448,7 +448,7 @@ enum eGravity { gsNormal, gsLevitation, gsAnti };
#endif
EX eGravity gravity_state, last_gravity_state;
bool bird_disruption(cell *c) {
EX bool bird_disruption(cell *c) {
return c->cpdist <= 5 && items[itOrbGravity];
}
@ -1473,8 +1473,6 @@ EX bool monstersnear(stalemate1& sm) {
return !!res;
}
namespace multi { bool aftermove; }
EX bool monstersnear2();
EX int lastkills;
@ -1497,7 +1495,10 @@ EX bool multimove() {
return b;
}
namespace multi { bool checkonly = false; }
EX namespace multi {
EX bool checkonly = false;
EX bool aftermove;
EX }
EX bool swordConflict(const stalemate1& sm1, const stalemate1& sm2) {
if(items[itOrbSword] || items[itOrbSword2])
@ -2834,7 +2835,7 @@ EX void findWormIvy(cell *c) {
bool bugsfighting;
bool keepLightning = false;
EX bool keepLightning = false;
EX int statuecount;
@ -6633,7 +6634,7 @@ EX void activateSafety(eLand l) {
restartGraph();
}
bool legalmoves[MAX_EDGE+1];
EX bool legalmoves[MAX_EDGE+1];
EX bool hasSafeOrb(cell *c) {
return
@ -7584,7 +7585,7 @@ EX void knightFlavorMessage(cell *c2) {
msgid++;
}
int mine_adjacency_rule = 0;
EX int mine_adjacency_rule = 0;
EX map<cell*, vector<cell*>> adj_memo;
@ -7677,7 +7678,7 @@ EX bool uncoverMines(cell *c, int lev, int dist, bool just_checking) {
return b;
}
namespace orbbull {
EX namespace orbbull {
cell *prev[MAXPLAYER];
eLastmovetype prevtype[MAXPLAYER];
int count;
@ -7688,7 +7689,7 @@ namespace orbbull {
return lp >= 0 && ln >= 0 && anglestraight(c2, lp, ln);
}
void gainBullPowers() {
EX void gainBullPowers() {
items[itOrbShield]++; orbused[itOrbShield] = true;
items[itOrbThorns]++; orbused[itOrbThorns] = true;
items[itOrbHorns]++; orbused[itOrbHorns] = true;
@ -7725,7 +7726,7 @@ namespace orbbull {
}
else count = 0;
}
}
EX }
#if HDR
// predictable or not
@ -7951,7 +7952,7 @@ EX bool havePushConflict(cell *pushto, bool checkonly) {
return false;
}
cell *global_pushto;
EX cell *global_pushto;
EX void killFriendlyIvy() {
forCellEx(c2, cwt.at) if(c2->monst == moFriendlyIvy)

View File

@ -281,7 +281,7 @@ void validity_info() {
dialog::addBreak(100);
}
bool showquotients;
EX bool showquotients;
string validclasses[4] = {" (X)", " (½)", "", " (!)"};

View File

@ -648,7 +648,7 @@ EX namespace geom3 {
if(GDIM == 3) return vid.depth - lev;
return projection_to_factor(lev_to_projection(lev));
}
ld factor_to_lev(ld fac) {
EX ld factor_to_lev(ld fac) {
if(prod) return -fac;
if(GDIM == 3) return fac;
return vid.depth - projection_to_abslev(factor_to_projection(fac));
@ -666,7 +666,7 @@ EX namespace geom3 {
}
// how should we scale at level lev
ld scale_at_lev(ld lev) {
EX ld scale_at_lev(ld lev) {
if(sphere || euclid) return 1;
return cosh(vid.depth - lev);
}

View File

@ -10,14 +10,14 @@ namespace hr {
transmatrix &ggmatrix(cell *c);
void fixelliptic(transmatrix& at) {
EX void fixelliptic(transmatrix& at) {
if(elliptic && at[LDIM][LDIM] < 0) {
for(int i=0; i<MDIM; i++) for(int j=0; j<MDIM; j++)
at[i][j] = -at[i][j];
}
}
void fixelliptic(hyperpoint& h) {
EX void fixelliptic(hyperpoint& h) {
if(elliptic && h[LDIM] < 0)
for(int i=0; i<MDIM; i++) h[i] = -h[i];
}

View File

@ -74,9 +74,9 @@ EX bool auraNOGL; // aura without GL
int axestate;
EX int ticks;
int frameid;
EX int frameid;
bool camelotcheat;
EX bool camelotcheat;
EX bool nomap;
EX eItem orbToTarget;
@ -3489,7 +3489,6 @@ void setcolors(cell *c, color_t& wcol, color_t& fcol) {
#if CAP_COMPLEX2
case laBrownian: {
using brownian::level;
fcol = wcol =
/*
c->landparam == 0 ? 0x0000F0 :
@ -7528,7 +7527,7 @@ EX void drawmovestar(double dx, double dy) {
// old style joystick control
bool dronemode;
EX bool dronemode;
purehookset hooks_calcparam;

View File

@ -224,7 +224,7 @@ string princedesc() {
return XLAT("Apparently a princess is kept locked somewhere, but you won't ever find her in this hyperbolic palace. ");
}
string helptitle(string s, color_t col) {
EX string helptitle(string s, color_t col) {
return "@" + its(col) + "\t" + s + "\n";
}
@ -482,7 +482,7 @@ void addMinefieldExplanation(string& s) {
#endif
}
string generateHelpForWall(eWall w) {
EX string generateHelpForWall(eWall w) {
string s = helptitle(XLATN(winf[w].name), winf[w].color);
@ -502,7 +502,7 @@ void buteol(string& s, int current, int req) {
s += buf; s += "\n";
}
string generateHelpForMonster(eMonster m) {
EX string generateHelpForMonster(eMonster m) {
string s = helptitle(XLATN(minf[m].name), minf[m].color);
if(m == moPlayer) {
@ -705,7 +705,7 @@ string generateHelpForLand(eLand l) {
return s;
}
bool instat;
EX bool instat;
string turnstring(int i) {
if(i == 1) return XLAT("1 turn");
@ -713,7 +713,7 @@ string turnstring(int i) {
}
reaction_t helpgenerator;
string bygen(reaction_t h) {
EX string bygen(reaction_t h) {
helpgenerator = h;
return "HELPGEN";
}
@ -732,7 +732,7 @@ void gotoHelpFor(eMonster m) {
help = generateHelpForMonster(m);
};
void appendHelp(string s) {
EX void appendHelp(string s) {
auto h = helpgenerator;
if(help == "HELPGEN")
bygen([h,s] { h(); help += s; });
@ -954,7 +954,7 @@ EX void showHelp() {
};
}
hookset<bool()> *hooks_default_help;
EX hookset<bool()> *hooks_default_help;
EX void gotoHelp(const string& h) {
help = h;

View File

@ -24,7 +24,7 @@ cell *newCell(int type, heptagon *master);
* and sometimes in direction 5
*/
hstate transition(hstate s, int dir) {
EX hstate transition(hstate s, int dir) {
if(sphere) {
if(S7 == 4) {
if(s == hsOrigin) return dir == 0 ? hsB0 : hsB1;

View File

@ -347,7 +347,7 @@ EX namespace history {
void restoreBack();
#if CAP_SDL
void createImage(bool dospiral) {
EX void createImage(bool dospiral) {
int segid = 1;
if(includeHistory) restore();
@ -569,7 +569,7 @@ EX namespace history {
else if(doexiton(sym, uni)) popScreen();
}
set<cell*> inmovehistory, inkillhistory, infindhistory;
EX set<cell*> inmovehistory, inkillhistory, infindhistory;
EX void restore() {
inmovehistory.clear();

View File

@ -21,7 +21,7 @@ void ghcheck(hyperpoint &ret, const hyperpoint &H) {
}
}
void camrotate(ld& hx, ld& hy) {
EX void camrotate(ld& hx, ld& hy) {
ld cam = vid.camera_angle * degree;
GLfloat cc = cos(cam);
GLfloat ss = sin(cam);
@ -845,7 +845,7 @@ EX transmatrix mirrorif(const transmatrix& V, bool b) {
}
// -1 if away, 0 if not away
int away(const transmatrix& V2) {
EX int away(const transmatrix& V2) {
return (intval(C0, V2 * xpush0(.1)) > intval(C0, tC0(V2))) ? -1 : 0;
}
@ -856,7 +856,7 @@ int away(const transmatrix& V2) {
return lev_to_factor(fo1 + (fo2-fo1) * nom / den);
} */
double zgrad0(double l1, double l2, int nom, int den) {
EX double zgrad0(double l1, double l2, int nom, int den) {
using namespace geom3;
return lev_to_factor(l1 + (l2-l1) * nom / den);
}
@ -883,7 +883,7 @@ ld to01(ld a0, ld a1, ld x) {
return (x-a0) / (a1-a0);
}
ld spherity(const hyperpoint& h) {
EX ld spherity(const hyperpoint& h) {
if(!sphere) return 1;
if(vid.alpha > 1) {
@ -901,7 +901,7 @@ EX bool behindsphere(const transmatrix& V) {
return behindsphere(tC0(V));
}
ld spherity(const transmatrix& V) {
EX ld spherity(const transmatrix& V) {
return spherity(tC0(V));
}

View File

@ -87,7 +87,7 @@ bool clockwise(hyperpoint h1, hyperpoint h2) {
return h1[0] * h2[1] > h1[1] * h2[0];
}
map<heptagon*, vector<int> > cells_of_heptagon;
EX map<heptagon*, vector<int> > cells_of_heptagon;
int runlevel;
vector<ld> edgelens, distlens;

View File

@ -22,15 +22,18 @@ EX namespace mapeditor {
eFront front_config;
ld front_step = 0.1;
#if HDR
struct editwhat {
double dist;
int rotid, symid, pointid;
bool side;
cell *c;
} ew, ewsearch;
bool autochoose = ISMOBILE;
};
#endif
EX editwhat ew, ewsearch;
EX bool autochoose = ISMOBILE;
void scaleall(ld z) {
EX void scaleall(ld z) {
// (mx,my) = (xcb,ycb) + ss * (xpos,ypos) + (mrx,mry) * scale
@ -1094,7 +1097,7 @@ namespace mapeditor {
// fake key sent to change the color
static const int COLORKEY = (-10000);
transmatrix drawtrans, drawtransnew;
EX transmatrix drawtrans, drawtransnew;
#if CAP_POLY
void loadShape(int sg, int id, hpcshape& sh, int d, int layer) {
@ -1106,7 +1109,7 @@ namespace mapeditor {
}
#endif
void drawGhosts(cell *c, const transmatrix& V, int ct) {
EX void drawGhosts(cell *c, const transmatrix& V, int ct) {
}
hyperpoint ccenter = C0;
@ -1158,7 +1161,7 @@ namespace mapeditor {
int parallels = 12, meridians = 6;
ld equi_range = 1;
void drawGrid() {
EX void drawGrid() {
color_t lightgrid = gridcolor;
lightgrid -= (lightgrid & 0xFF) / 2;
transmatrix d2 = drawtrans * rgpushxto0(ccenter) * rspintox(gpushxto0(ccenter) * coldcenter);
@ -2102,7 +2105,7 @@ namespace mapeditor {
#endif
#if CAP_POLY
bool haveUserShape(eShapegroup group, int id) {
EX bool haveUserShape(eShapegroup group, int id) {
#if !CAP_EDIT
return false;
#else
@ -2112,7 +2115,7 @@ namespace mapeditor {
#endif
#if CAP_TEXTURE
void draw_texture_ghosts(cell *c, const transmatrix& V) {
EX void draw_texture_ghosts(cell *c, const transmatrix& V) {
if(!c) return;
if(holdmouse && !lstartcell) return;
cell *ls = lstartcell ? lstartcell : lmouseover;

View File

@ -643,7 +643,7 @@ EX bool showHalloween() {
int daily_mode;
purehookset hooks_startmenu;
EX purehookset hooks_startmenu;
EX void showStartMenu() {
if(!daily_mode) {
@ -923,8 +923,8 @@ EX named_functionality get_o_key() {
return named_dialog(XLAT("world overview"), showOverview);
}
int messagelogpos;
int timeformat;
EX int messagelogpos;
EX int timeformat;
EX int stampbase;
EX string gettimestamp(msginfo& m) {

View File

@ -104,7 +104,7 @@ EX namespace polygonal {
return make_pair(real(res), imag(res));
}
pair<ld, ld> compute(ld x, ld y) { return compute(x,y,deg); }
EX pair<ld, ld> compute(ld x, ld y) { return compute(x,y,deg); }
EX }
#if HDR
@ -152,13 +152,13 @@ EX namespace models {
int spiral_id = 7;
EX bool use_atan = false;
cld spiral_multiplier;
ld right_spiral_multiplier = 1;
ld any_spiral_multiplier = 1;
ld sphere_spiral_multiplier = 2;
EX cld spiral_multiplier;
EX ld right_spiral_multiplier = 1;
EX ld any_spiral_multiplier = 1;
EX ld sphere_spiral_multiplier = 2;
EX ld spiral_cone = 360;
ld spiral_cone_rad;
bool ring_not_spiral;
EX ld spiral_cone_rad;
EX bool ring_not_spiral;
EX void configure() {
ld ball = -vid.ballangle * degree;

View File

@ -55,10 +55,10 @@ EX namespace multi {
}
}
transmatrix whereis[MAXPLAYER];
transmatrix crosscenter[MAXPLAYER];
double ccdist[MAXPLAYER];
cell *ccat[MAXPLAYER];
EX transmatrix whereis[MAXPLAYER];
EX transmatrix crosscenter[MAXPLAYER];
EX double ccdist[MAXPLAYER];
EX cell *ccat[MAXPLAYER];
bool combo[MAXPLAYER];
@ -67,7 +67,7 @@ EX namespace multi {
EX movedir whereto[MAXPLAYER]; // player's target cell
double mdx[MAXPLAYER], mdy[MAXPLAYER]; // movement vector for the next move
EX double mdx[MAXPLAYER], mdy[MAXPLAYER]; // movement vector for the next move
static const int CMDS = 15;
static const int CMDS_PAN = 11;
@ -109,9 +109,11 @@ EX namespace multi {
"scroll forward", "scroll backward"
};
#if HDR
#define SHMUPAXES_BASE 4
#define SHMUPAXES ((SHMUPAXES_BASE) + 4 * (MAXPLAYER))
#define SHMUPAXES_CUR ((SHMUPAXES_BASE) + 4 * playercfg)
#endif
const char* axemodes[SHMUPAXES] = {
"do nothing",
@ -155,7 +157,7 @@ const char* axemodes3[4] = {
"camera rotate Y"
};
int centerplayer = -1;
EX int centerplayer = -1;
char* axeconfigs[24]; int numaxeconfigs;
int* dzconfigs[24];
@ -195,7 +197,7 @@ string dsc(int id) {
return buf;
}
void resetScores() {
EX void resetScores() {
for(int i=0; i<MAXPLAYER; i++)
multi::treasures[i] = multi::kills[i] = multi::deaths[i] = 0;
}
@ -204,7 +206,7 @@ bool configdead;
void handleConfig(int sym, int uni);
string player_count_name(int p) {
EX string player_count_name(int p) {
return XLAT(
p == 2 ? "two players" :
p == 3 ? "three players" :
@ -300,6 +302,8 @@ struct key_configurer {
}
};
EX reaction_t get_key_configurer(int sc, vector<string>& sct) { return key_configurer(sc, sct); }
#if CAP_SDLJOY
struct joy_configurer {
@ -510,6 +514,7 @@ EX void showConfigureMultiplayer() {
dialog::display();
}
#if HDR
#define NUMACT 128
enum pcmds {
@ -518,15 +523,16 @@ enum pcmds {
pcFire, pcFace, pcFaceFire,
pcDrop, pcCenter, pcOrbPower, pcOrbKey
};
#endif
int actionspressed[NUMACT], axespressed[SHMUPAXES], lactionpressed[NUMACT];
EX int actionspressed[NUMACT], axespressed[SHMUPAXES], lactionpressed[NUMACT];
void pressaction(int id) {
if(id >= 0 && id < NUMACT)
actionspressed[id]++;
}
bool notremapped(int sym) {
EX bool notremapped(int sym) {
int k = scfg.keyaction[sym];
if(k == 0) return true;
k /= 16;
@ -652,7 +658,7 @@ EX void initConfig() {
for(int i=0; i<7; i++) addsaver(multi::scs[i], "player"+its(i));
}
void handleInput(int delta) {
EX void handleInput(int delta) {
#if CAP_SDL
double d = delta / 500.;
@ -750,7 +756,7 @@ void handleInput(int delta) {
#endif
}
int tableid[7] = {1, 2, 4, 5, 6, 7, 8};
EX int tableid[7] = {1, 2, 4, 5, 6, 7, 8};
EX void leaveGame(int i) {
multi::player[i].at = NULL;
@ -795,7 +801,7 @@ void handleInput(int delta) {
bool needinput = true;
void handleMulti(int delta) {
EX void handleMulti(int delta) {
multi::handleInput(delta);
transmatrix bcwtV = cwtV;
@ -929,7 +935,7 @@ void handleInput(int delta) {
}
}
void mousemovement(cell *c) {
EX void mousemovement(cell *c) {
if(!c) return;
int countplayers = 0;
int countplayers_undecided = 0;

View File

@ -7,7 +7,9 @@
#include "hyper.h"
#if CAP_MODEL
namespace hr { namespace netgen {
namespace hr {
EX namespace netgen {
// We need a two-dimensional vector class for this.
@ -70,9 +72,9 @@ namespace hr { namespace netgen {
// Use HyperRogue to generate the data (ct, vx, nei).
int mode = 0;
EX int mode = 0;
void buildVertexInfo(cell *c, transmatrix V) {
EX void buildVertexInfo(cell *c, transmatrix V) {
if(mode == 1)
for(int ii=0; ii<CELLS; ii++) if(dcal[ii] == c) {
@ -699,7 +701,7 @@ namespace hr { namespace netgen {
};
}
void run() {
EX void run() {
if(euclid)
addMessage("Useless in Euclidean geometry.");
else if(sphere)
@ -707,5 +709,7 @@ namespace hr { namespace netgen {
else
pushScreen(show);
}
}}
EX }
}
#endif

View File

@ -785,7 +785,7 @@ EX namespace product {
EX int cwall_offset, cwall_mask, actual_view_level;
void drawcell_stack(cell *c, transmatrix V, int spinv, bool mirrored) {
EX void drawcell_stack(cell *c, transmatrix V, int spinv, bool mirrored) {
if(sphere) gmatrix[c] = V; /* some computations need gmatrix0 for underlying geometry */
bool s = sphere;
hybrid::in_actual([&] {

View File

@ -428,9 +428,6 @@ EX int fieldval_uniq_rand(cell *c, int randval) {
}
}
int subpathid = currfp.matcode[currfp.strtomatrix("RRRPRRRRRPRRRP")];
int subpathorder = currfp.order(currfp.matrices[subpathid]);
pair<int, int> subval(cell *c, int _subpathid = subpathid, int _subpathorder = subpathorder) {
if(!ctof(c)) {
auto m = subval(createMov(c, 0));
@ -642,7 +639,7 @@ EX namespace patterns {
}
}
int downdir(cell *c, const cellfunction& cf) {
EX int downdir(cell *c, const cellfunction& cf) {
return parent_id(c, 1, cf) + 1;
}
@ -1781,7 +1778,7 @@ EX namespace patterns {
};
}
void showPrePattern() { showPrePatternP(true); }
EX void showPrePattern() { showPrePatternP(true); }
EX void showPrePatternNoninstant() { showPrePatternP(false); }
@ -2180,7 +2177,7 @@ EX namespace patterns {
}
EX }
bool is_master(cell *c) {
EX bool is_master(cell *c) {
if(euclid) return pseudohept(c);
else return c->master->c7 == c;
}
@ -2269,7 +2266,7 @@ EX namespace linepatterns {
{patParallels, "parallels", 0xFFFFFF00, 1},
};
void clearAll() {
EX void clearAll() {
for(auto& lp: patterns) lp.color &= ~255;
}

View File

@ -15,8 +15,6 @@ static constexpr ld NEWSHAPE = (-13.5);
#endif
static constexpr ld WOLF = (-15.5);
EX long double polydata[];
void geometry_information::hpcpush(hyperpoint h) {
if(sphere) h = mid(h,h);
ld threshold = (GDIM == 3 || last->flags & POLY_TRIANGLES) ? 100 : (sphere ? (ISMOBWEB || NONSTDVAR ? .04 : .001) : 0.1) * pow(.25, vid.linequality);
@ -1529,7 +1527,7 @@ void geometry_information::prepare_shapes() {
initPolyForGL();
}
long double polydata[] = {
EX vector<long double> polydata = {
// shStarFloor[0] (6x1)
NEWSHAPE, 1,6,1, 0.267355,0.153145, 0.158858,0.062321, 0.357493,-0.060252,
// shStarFloor[1] (7x1)

View File

@ -39,7 +39,8 @@ EX namespace quotientspace {
return res;
}
int rvadd = 0, rvdir = 1;
EX int rvadd = 0;
EX int rvdir = 1;
int rv(int x) { return (rvadd+x*rvdir) % S7; }

View File

@ -42,7 +42,7 @@ vector<race_cellinfo> rti;
EX vector<cell*> track;
map<cell*, int> rti_id;
int trophy[MAXPLAYER];
EX int trophy[MAXPLAYER];
EX string track_code = "OFFICIAL";
@ -685,7 +685,7 @@ bool inrec = false;
EX ld race_angle = 90;
bool set_view() {
EX bool set_view() {
multi::cpid = subscreens::in ? subscreens::current_player : 0;
@ -1066,20 +1066,20 @@ void race_projection() {
dialog::addBoolItem_action(XLAT("guiding line"), guiding, 'g');
dialog::addItem(shmup::player_count_name(playercfg), 'n');
dialog::addItem(multi::player_count_name(playercfg), 'n');
dialog::add_action([/*this*/] () {
playercfg = playercfg == 1 ? 2 : 1;
});
dialog::addItem(XLAT("configure player 1"), '1');
dialog::add_action([] () {
pushScreen(shmup::key_configurer(1, playercmds_race));
pushScreen(multi::get_key_configurer(1, playercmds_race));
});
if(playercfg >= 2) {
dialog::addItem(XLAT("configure player 2"), '2');
dialog::add_action([] () {
pushScreen(shmup::key_configurer(2, playercmds_race));
pushScreen(multi::get_key_configurer(2, playercmds_race));
});
}
else dialog::addBreak(100);
@ -1271,11 +1271,11 @@ transmatrix racerel(ld rel) {
return atscreenpos(bsize, vid.yres - bsize - rel * (vid.yres - bsize*2) / 100, bsize) * spin(M_PI/2);
}
int get_percentage(cell *c) {
EX int get_percentage(cell *c) {
return min(get_info(c).completion * 100 / (isize(track) - DROP), 100);
}
int get_percentage(int i) {
EX int get_percentage(int i) {
return get_percentage(shmup::pc[i]->base);
}
@ -1286,7 +1286,7 @@ void draw_ghost_state(ghost& ghost) {
draw_ghost_at(ghost, w, racerel(result), p);
}
void drawStats() {
EX void drawStats() {
if(!racing::on) return;
@ -1314,7 +1314,7 @@ void drawStats() {
quickqueue();
}
void markers() {
EX void markers() {
if(!racing::on) return;
if(guiding && WDIM == 2) for(int i=0; i<multi::players; i++) {
shmup::monster *m = shmup::pc[i];

View File

@ -32,7 +32,7 @@ EX namespace reg3 {
return int(x * 10 + 100000.5) - 100000;
}
int bucketer(hyperpoint h) {
EX int bucketer(hyperpoint h) {
return bucketer(h[0]) + 1000 * bucketer(h[1]) + 1000000 * bucketer(h[2]);
}

18
rug.cpp
View File

@ -115,7 +115,7 @@ EX ld anticusp_dist;
EX ld err_zero = 1e-3, err_zero_current, current_total_error;
int queueiter, qvalid, dt;
EX int queueiter, qvalid, dt;
EX rugpoint *finger_center;
EX ld finger_range = .1;
@ -123,7 +123,7 @@ EX ld finger_force = 1;
EX int rugdim;
bool rug_perspective = ISANDROID;
EX bool rug_perspective = ISANDROID;
// extra geometry functions
//--------------------------
@ -225,7 +225,7 @@ void push_point(hyperpoint& h, int coord, ld val) {
}
}
void push_all_points(int coord, ld val) {
EX void push_all_points(int coord, ld val) {
if(!val) return;
else for(int i=0; i<isize(points); i++)
push_point(points[i]->flat, coord, val);
@ -407,7 +407,7 @@ bool psort(rugpoint *a, rugpoint *b) {
return hdist0(a->h) < hdist0(b->h);
}
void sort_rug_points() {
EX void sort_rug_points() {
sort(points.begin(), points.end(), psort);
}
@ -738,7 +738,8 @@ EX void buildRug() {
// rug physics
queue<rugpoint*> pqueue;
void enqueue(rugpoint *m) {
EX void enqueue(rugpoint *m) {
if(m->inqueue) return;
pqueue.push(m);
m->inqueue = true;
@ -1368,11 +1369,12 @@ double xview, yview;
EX bool no_fog;
EX ld lowrug = 1e-2, hirug = 1e3;
EX ld lowrug = 1e-2;
EX ld hirug = 1e3;
GLuint alternate_texture;
EX GLuint alternate_texture;
bool invert_depth;
EX bool invert_depth;
EX void drawRugScene() {
glbuf->use_as_texture();

View File

@ -183,7 +183,7 @@ EX void set_if_removed(cell*& c, cell *val) {
typedef array<char, 1048576> reserve_block;
int reserve_count = 0;
EX int reserve_count = 0;
EX int reserve_limit = 128;
const int max_reserve = 4096;
@ -226,7 +226,7 @@ EX void apply_memory_reserve() {
#endif
}
void memory_for_lib() {
EX void memory_for_lib() {
if(reserve_count) { reserve_count--; delete reserve[reserve_count]; }
}
@ -284,7 +284,7 @@ EX void show_memory_menu() {
dialog::display();
}
bool protect_memory() {
EX bool protect_memory() {
if(!CAP_MEMORY_RESERVE) return false;
apply_memory_reserve();
if(reserve_limit && reserve_count < reserve_limit && !ignored_memory_warning) {
@ -298,7 +298,7 @@ bool protect_memory() {
return false;
}
bool memory_issues() {
EX bool memory_issues() {
return reserve_limit && reserve_count < 16;
}

View File

@ -39,7 +39,7 @@ EX namespace svg {
}
int svgsize;
int divby = 10;
EX int divby = 10;
const char* coord(int val) {
static char buf[10][20];
@ -586,7 +586,7 @@ bool needs_highqual;
bool joukowsky_anim;
void reflect_view() {
EX void reflect_view() {
if(centerover.at) {
transmatrix T = Id;
cell *mbase = centerover.at;

View File

@ -29,7 +29,7 @@ EX void glError(const char* GLcall, const char* file, const int line) {
#endif
#if CAP_SHADER && CAP_NOSHADER
#define WITHSHADER(x, y) if(noshaders) y else x
#define WITHSHADER(x, y) if(glhr::noshaders) y else x
#else
#if CAP_NOSHADER
#define WITHSHADER(x, y) if(1) y
@ -498,7 +498,7 @@ EX void color2(color_t color, ld scale IS(1)) {
)
}
void colorClear(color_t color) {
EX void colorClear(color_t color) {
glClearColor(part(color, 3) / 255.0, part(color, 2) / 255.0, part(color, 1) / 255.0, part(color, 0) / 255.0);
}
@ -1022,14 +1022,14 @@ EX vector<glhr::textured_vertex> text_vertices;
EX void texture_vertices(GLfloat *f, int qty, int stride IS(2)) {
WITHSHADER(
glVertexAttribPointer(aTexture, stride, GL_FLOAT, GL_FALSE, stride * sizeof(GLfloat), f);,
glVertexAttribPointer(glhr::aTexture, stride, GL_FLOAT, GL_FALSE, stride * sizeof(GLfloat), f);,
glTexCoordPointer(stride, GL_FLOAT, 0, f);
)
}
EX void oldvertices(GLfloat *f, int qty) {
WITHSHADER(
glVertexAttribPointer(aPosition, SHDIM, GL_FLOAT, GL_FALSE, SHDIM * sizeof(GLfloat), f);,
glVertexAttribPointer(glhr::aPosition, SHDIM, GL_FLOAT, GL_FALSE, SHDIM * sizeof(GLfloat), f);,
glVertexPointer(SHDIM, GL_FLOAT, 0, f);
)
}

View File

@ -9,17 +9,17 @@
namespace hr {
// joysticks for controlling the mobile shmup mode
namespace shmupballs {
int xmove, xfire, yb, rad;
EX namespace shmupballs {
EX int xmove, xfire, yb, rad;
void calc() {
EX void calc() {
int rr = int(realradius());
rad = int(rr * (vid.mobilecompasssize ? vid.mobilecompasssize : 14) / 100);
xmove = max(current_display->xcenter - rr - rad, rad);
xfire = min(current_display->xcenter + rr + rad, vid.xres - rad);
yb = current_display->ycenter + rr - rad;
}
}
EX }
ld sqdist(hyperpoint a, hyperpoint b) {
if(prod) return pow(hdist(a, b), 2);
@ -38,8 +38,10 @@ void profile(const char *buf) {
}
*/
#if HDR
#define SCALE cgi.scalefactor
#define SCALE2 (SCALE*SCALE)
#endif
EX namespace shmup {
@ -103,7 +105,9 @@ bool lastdead = false;
EX multimap<cell*, monster*> monstersAt;
#if HDR
typedef multimap<cell*, monster*>::iterator mit;
#endif
vector<monster*> active, nonvirtual, additional;
@ -293,7 +297,7 @@ EX void degradeDemons() {
}
// we need these for the Mimics!
double playerturn[MAXPLAYER], playergo[MAXPLAYER], playerstrafe[MAXPLAYER], playerturny[MAXPLAYER], playergoturn[MAXPLAYER], godir[MAXPLAYER];
EX double playerturn[MAXPLAYER], playergo[MAXPLAYER], playerstrafe[MAXPLAYER], playerturny[MAXPLAYER], playergoturn[MAXPLAYER], godir[MAXPLAYER];
bool playerfire[MAXPLAYER];
void awakenMimics(monster *m, cell *c2) {
@ -565,7 +569,7 @@ ld getSwordSize() { return cgi.sword_size; }
ld getHornsSize() { return cgi.scalefactor * 0.33; }
// used in 3D
transmatrix swordmatrix[MAXPLAYER];
EX transmatrix swordmatrix[MAXPLAYER];
hyperpoint swordpos(int id, bool rev, double frac) {
if(WDIM == 3)
@ -1292,7 +1296,7 @@ void movePlayer(monster *m, int delta) {
dropGreenStone(m->base);
}
monster *getPlayer() {
EX monster *getPlayer() {
return pc[cpid];
}
@ -2728,7 +2732,7 @@ EX bool boatAt(cell *c) {
EX hookset<bool(const transmatrix&, cell*, shmup::monster*)> *hooks_draw;
bool drawMonster(const transmatrix& V, cell *c, const transmatrix*& Vboat, transmatrix& Vboat0, const transmatrix *Vdp) {
EX bool drawMonster(const transmatrix& V, cell *c, const transmatrix*& Vboat, transmatrix& Vboat0, const transmatrix *Vdp) {
#if CAP_SHAPES
pair<mit, mit> p =

View File

@ -52,11 +52,11 @@ EX int savecount;
EX bool showoff = false;
EX bool doCross = false;
bool gamegen_failure;
EX bool gamegen_failure;
EX eLand top_land;
bool verless(string v, string cmp) {
EX bool verless(string v, string cmp) {
if(isdigit(v[0]) && isdigit(v[1]))
v = "A" + v;
if(isdigit(cmp[0]) && isdigit(cmp[1]))
@ -70,9 +70,9 @@ bool do_use_special_land() {
(peace::on || tactic::on || geometry || NONSTDVAR || randomPatternsMode || yendor::on || racing::on);
}
hookset<bool()> *hooks_welcome_message;
EX hookset<bool()> *hooks_welcome_message;
void welcomeMessage() {
EX void welcomeMessage() {
if(callhandlers(false, hooks_welcome_message)) return;
else if(tactic::trailer) return;
#if CAP_TOUR
@ -137,7 +137,7 @@ int trailer_cash0 = 5;
int trailer_cash1 = 15;
bool trailer_safety = true;
hookset<void()> *hooks_initgame;
EX hookset<void()> *hooks_initgame;
// initialize the game
EX void initgame() {
@ -386,20 +386,22 @@ EX void initgame() {
bool havesave = true;
#if CAP_SAVE
#if HDR
#define MAXBOX 500
#define POSSCORE 371 // update this when new boxes are added!
struct score {
string ver;
int box[MAXBOX];
};
#endif
int savebox[MAXBOX], boxid;
bool saving, loading, loadingHi;
EX int savebox[MAXBOX], boxid;
EX bool saving, loading, loadingHi;
string boxname[MAXBOX];
bool fakebox[MAXBOX];
bool monsbox[MAXBOX];
EX string boxname[MAXBOX];
EX bool fakebox[MAXBOX];
EX bool monsbox[MAXBOX];
void applyBox(int& t) {
if(saving) savebox[boxid++] = t;
@ -477,7 +479,7 @@ void applyBoxM(eMonster m, bool f = false) {
applyBox(kills[m]);
}
void applyBoxes() {
EX void applyBoxes() {
invorb.clear();
eLand lostin = laNone;
@ -811,7 +813,7 @@ void applyBoxes() {
if(POSSCORE != boxid) printf("ERROR: %d boxes\n", boxid);
}
void saveBox() {
EX void saveBox() {
boxid = 0; saving = true; applyBoxes(); saving = false;
}
@ -848,24 +850,29 @@ void loadBoxHigh() {
// certify that saves and achievements were received
// in an official version of HyperRogue
EX namespace anticheat {
EX int certify(const string& s, int a, int b, int c, int d IS(0));
EX }
#if CAP_CERTIFY
#include "private/certify.cpp"
#else
#endif
namespace anticheat {
bool tampered;
#if !CAP_CERTIFY
EX namespace anticheat {
EX bool tampered;
void save(FILE *f) {}
bool load(FILE *f, score& sc, const string& ver) {return true; }
int certify(const string& s, int a, int b, int c, int d=0) { return d; }
int certify(const string& s, int a, int b, int c, int d) { return d; }
int check(int cv, const string& ver, const string& s, int a, int b, int c, int d=0) { return cv==d; }
void nextid(int& tid, const string& ver, int cert) { tid++; }
};
EX }
#endif
long long saveposition = -1;
void remove_emergency_save() {
EX void remove_emergency_save() {
#if !ISWINDOWS
if(saveposition >= 0) {
if(truncate(scorefile, saveposition)) {}

View File

@ -12,7 +12,7 @@ EX namespace tour {
EX bool on;
bool texts = true;
EX bool texts = true;
EX string tourhelp;

View File

@ -166,9 +166,11 @@ EX namespace yendor {
#endif
EX vector<yendorinfo> yi;
#if HDR
#define NOYENDOR 999999
int yii = NOYENDOR;
#endif
EX int yii = NOYENDOR;
EX int hardness() {
if(peace::on) return 15; // just to generate monsters
@ -607,7 +609,7 @@ EX namespace yendor {
};
vector<scoredata> scoreboard;
const char *chelp =
EX const char *chelp =
"There are many possible solutions to the Yendor Quest. In the Yendor "
"Challenge, you will try many of them!\n\n"
"Each challenge takes part in a specific land, and you have to use what "
@ -640,7 +642,7 @@ EX namespace yendor {
return 0;
}
void showMenu() {
EX void showMenu() {
set_priority_board(LB_YENDOR_CHALLENGE);
int s = vid.fsize;
vid.fsize = vid.fsize * 4/5;
@ -874,7 +876,7 @@ EX namespace tactic {
uploadScoreCode(4, LB_PURE_TACTICS_COOP);
}
void showMenu() {
EX void showMenu() {
int xc = modecode();
@ -1307,7 +1309,7 @@ EX namespace peace {
}
EX }
void showMenu() {
EX void showMenu() {
listLevels();
dialog::init(XLAT(otherpuzzles ? "puzzles and exploration" : "memory game"), 0x40A040, 150, 100);