diff --git a/3d-models.cpp b/3d-models.cpp index c8a4589e..aa19e35c 100644 --- a/3d-models.cpp +++ b/3d-models.cpp @@ -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 geometry_information::get_shape(hpcshape sh) { vector res; @@ -43,7 +43,7 @@ hyperpoint get_center(const vector& 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= 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 msgs; +EX vector msgs; -vector gamelog; +EX vector gamelog; EX void flashMessages() { for(int i=0; i 1) s += " (x" + its(m.quantity) + ")"; return s; @@ -1443,8 +1443,8 @@ EX int calcfps() { EX namespace subscreens { - vector player_displays; - bool in; + EX vector player_displays; + EX bool in; EX int current_player; EX bool is_current_player(int id) { diff --git a/binary-tiling.cpp b/binary-tiling.cpp index b2673464..a84d75de 100644 --- a/binary-tiling.cpp +++ b/binary-tiling.cpp @@ -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; diff --git a/classes.cpp b/classes.cpp index ee08de3b..13eedffa 100644 --- a/classes.cpp +++ b/classes.cpp @@ -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", diff --git a/commandline.cpp b/commandline.cpp index afb1631c..0672dc57 100644 --- a/commandline.cpp +++ b/commandline.cpp @@ -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); } diff --git a/complex.cpp b/complex.cpp index 32294e8d..daef68dc 100644 --- a/complex.cpp +++ b/complex.cpp @@ -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 deadbug; vector 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; i0) { @@ -2685,7 +2685,7 @@ EX namespace sword { #endif - int sword_angles; + EX int sword_angles; EX array 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; itype; 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 windcodes; + EX vector windcodes; void wcheck(cell *a, cell *b) { int i = getId(a); diff --git a/complex2.cpp b/complex2.cpp index 03de7a32..8a4b0611 100644 --- a/complex2.cpp +++ b/complex2.cpp @@ -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 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); } diff --git a/config.cpp b/config.cpp index dd229a7a..f08b915a 100644 --- a/config.cpp +++ b/config.cpp @@ -111,7 +111,7 @@ template<> struct saver : dsaver { 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 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 void addsaverenum(T& i, U name) {} template 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"); diff --git a/control.cpp b/control.cpp index 957df18f..05f315cb 100644 --- a/control.cpp +++ b/control.cpp @@ -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; } diff --git a/crystal.cpp b/crystal.cpp index a34c39ed..1e677847 100644 --- a/crystal.cpp +++ b/crystal.cpp @@ -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); diff --git a/debug.cpp b/debug.cpp index 1abd966a..de458ac3 100644 --- a/debug.cpp +++ b/debug.cpp @@ -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 { diff --git a/dialogs.cpp b/dialogs.cpp index aad34025..6ed65eee 100644 --- a/dialogs.cpp +++ b/dialogs.cpp @@ -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; diff --git a/drawing.cpp b/drawing.cpp index 80f2cf65..5d368b5d 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -126,7 +126,7 @@ EX int shapes_merged; color_t triangle_color, line_color; vector triangle_vertices; vector 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 T& queuea(PPR prio, U... u) { ptds.push_back(unique_ptr(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) { diff --git a/euclid.cpp b/euclid.cpp index c9cfb1e0..5e7b49e6 100644 --- a/euclid.cpp +++ b/euclid.cpp @@ -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 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 g(geometry, square ? gEuclidSquare : gEuclid); dynamicval gx(sdx, dx); dynamicval 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; } diff --git a/expansion.cpp b/expansion.cpp index 28d72257..9025f6a8 100644 --- a/expansion.cpp +++ b/expansion.cpp @@ -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; diff --git a/fieldpattern.cpp b/fieldpattern.cpp index 5e82948a..437cb508 100644 --- a/fieldpattern.cpp +++ b/fieldpattern.cpp @@ -28,9 +28,6 @@ struct fgeomextra { }; #endif -extern int subpathid; -extern int subpathorder; - bool isprime(int n) { for(int k=2; k fgeomextras = { @@ -815,7 +816,7 @@ EX vector fgeomextras = { EX int current_extra = 0; -void nextPrime(fgeomextra& ex) { +EX void nextPrime(fgeomextra& ex) { dynamicval 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); } diff --git a/floorshapes.cpp b/floorshapes.cpp index e2ac4efd..43536788 100644 --- a/floorshapes.cpp +++ b/floorshapes.cpp @@ -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 &shv, color_t col, PPR prio = PPR::DEFAULT) { +EX struct dqi_poly *draw_shapevec(cell *c, const transmatrix& V, const vector &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 &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); diff --git a/game.cpp b/game.cpp index 32c80d07..8964f8b2 100644 --- a/game.cpp +++ b/game.cpp @@ -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 offscreen; EX vector pathqm; /** list of cells that the monsters are targetting (PCs, allies, Thumpers, etc.) */ -vector targets; +EX vector targets; /** monsters of specific types to move */ vector 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> 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) diff --git a/geom-exp.cpp b/geom-exp.cpp index 3e41d74c..dbff8b3b 100644 --- a/geom-exp.cpp +++ b/geom-exp.cpp @@ -281,7 +281,7 @@ void validity_info() { dialog::addBreak(100); } -bool showquotients; +EX bool showquotients; string validclasses[4] = {" (X)", " (½)", "", " (!)"}; diff --git a/geometry.cpp b/geometry.cpp index cd6589e2..cc4c4e0c 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -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); } diff --git a/geometry2.cpp b/geometry2.cpp index 85f95034..078290c3 100644 --- a/geometry2.cpp +++ b/geometry2.cpp @@ -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; ilandparam == 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; diff --git a/help.cpp b/help.cpp index c56d84e5..bfae76b9 100644 --- a/help.cpp +++ b/help.cpp @@ -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 *hooks_default_help; +EX hookset *hooks_default_help; EX void gotoHelp(const string& h) { help = h; diff --git a/heptagon.cpp b/heptagon.cpp index dfa1d7bb..ffd44c42 100644 --- a/heptagon.cpp +++ b/heptagon.cpp @@ -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; diff --git a/history.cpp b/history.cpp index db293027..724191a1 100644 --- a/history.cpp +++ b/history.cpp @@ -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 inmovehistory, inkillhistory, infindhistory; + EX set inmovehistory, inkillhistory, infindhistory; EX void restore() { inmovehistory.clear(); diff --git a/hypgraph.cpp b/hypgraph.cpp index 5120cb35..ebbd11aa 100644 --- a/hypgraph.cpp +++ b/hypgraph.cpp @@ -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)); } diff --git a/irregular.cpp b/irregular.cpp index 8674c8c1..a444ee6d 100644 --- a/irregular.cpp +++ b/irregular.cpp @@ -87,7 +87,7 @@ bool clockwise(hyperpoint h1, hyperpoint h2) { return h1[0] * h2[1] > h1[1] * h2[0]; } -map > cells_of_heptagon; +EX map > cells_of_heptagon; int runlevel; vector edgelens, distlens; diff --git a/mapeditor.cpp b/mapeditor.cpp index bd32492f..6c8e6d16 100644 --- a/mapeditor.cpp +++ b/mapeditor.cpp @@ -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; diff --git a/menus.cpp b/menus.cpp index a7ac5e96..ac4cdb2b 100644 --- a/menus.cpp +++ b/menus.cpp @@ -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) { diff --git a/models.cpp b/models.cpp index 7e8eee17..e91e7391 100644 --- a/models.cpp +++ b/models.cpp @@ -104,7 +104,7 @@ EX namespace polygonal { return make_pair(real(res), imag(res)); } - pair compute(ld x, ld y) { return compute(x,y,deg); } + EX pair 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; diff --git a/multi.cpp b/multi.cpp index 7c1830ac..a796f69c 100644 --- a/multi.cpp +++ b/multi.cpp @@ -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& 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; diff --git a/netgen.cpp b/netgen.cpp index 0df55d96..272b7326 100644 --- a/netgen.cpp +++ b/netgen.cpp @@ -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 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; } diff --git a/polygons.cpp b/polygons.cpp index 30e22459..eb3518f8 100644 --- a/polygons.cpp +++ b/polygons.cpp @@ -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 polydata = { // shStarFloor[0] (6x1) NEWSHAPE, 1,6,1, 0.267355,0.153145, 0.158858,0.062321, 0.357493,-0.060252, // shStarFloor[1] (7x1) diff --git a/quotient.cpp b/quotient.cpp index a0da1000..42bb1240 100644 --- a/quotient.cpp +++ b/quotient.cpp @@ -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; } diff --git a/racing.cpp b/racing.cpp index 32993b0a..f03ac421 100644 --- a/racing.cpp +++ b/racing.cpp @@ -42,7 +42,7 @@ vector rti; EX vector track; map 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; iflat, 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 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(); diff --git a/savemem.cpp b/savemem.cpp index 3a95575c..675eb1bb 100644 --- a/savemem.cpp +++ b/savemem.cpp @@ -183,7 +183,7 @@ EX void set_if_removed(cell*& c, cell *val) { typedef array 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; } diff --git a/screenshot.cpp b/screenshot.cpp index 3bdc3229..d3b8b979 100644 --- a/screenshot.cpp +++ b/screenshot.cpp @@ -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; diff --git a/shaders.cpp b/shaders.cpp index c5cbb03d..a73a45e6 100644 --- a/shaders.cpp +++ b/shaders.cpp @@ -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 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); ) } diff --git a/shmup.cpp b/shmup.cpp index 06bea663..38d3a1da 100644 --- a/shmup.cpp +++ b/shmup.cpp @@ -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 monstersAt; +#if HDR typedef multimap::iterator mit; +#endif vector 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 *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 p = diff --git a/system.cpp b/system.cpp index e751bd7a..7d74c211 100644 --- a/system.cpp +++ b/system.cpp @@ -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 *hooks_welcome_message; +EX hookset *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 *hooks_initgame; +EX hookset *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)) {} diff --git a/tour.cpp b/tour.cpp index 5e81cb6e..c68fc110 100644 --- a/tour.cpp +++ b/tour.cpp @@ -12,7 +12,7 @@ EX namespace tour { EX bool on; -bool texts = true; +EX bool texts = true; EX string tourhelp; diff --git a/yendor.cpp b/yendor.cpp index c00b5540..e2040c3f 100644 --- a/yendor.cpp +++ b/yendor.cpp @@ -166,9 +166,11 @@ EX namespace yendor { #endif EX vector 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 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);