more header cleanup

This commit is contained in:
Zeno Rogue 2019-08-09 22:07:03 +02:00
parent cb666fb24a
commit a423dbd2da
32 changed files with 487 additions and 852 deletions

View File

@ -4,7 +4,7 @@
namespace hr { namespace hr {
EX bool checkBarriersFront(cellwalker bb, int q, bool cross) { EX bool checkBarriersFront(cellwalker bb, int q IS(5), bool cross IS(false)) {
if(!ctof(bb.at)) if(!ctof(bb.at))
return false; return false;
@ -36,7 +36,7 @@ EX void preventbarriers(cell *c) {
if(c && c->bardir == NODIR) c->bardir = NOBARRIERS; if(c && c->bardir == NODIR) c->bardir = NOBARRIERS;
} }
EX bool checkBarriersBack(cellwalker bb, int q, bool cross) { EX bool checkBarriersBack(cellwalker bb, int q IS(5), bool cross IS(false)) {
// printf("back, %p, s%d\n", bb.at, bb.spin); // printf("back, %p, s%d\n", bb.at, bb.spin);
// if(mark) { printf("mpdist = %d [%d] bardir = %d spin=%d q=%d cross=%d\n", bb.at->mpdist, BARLEV, bb.at->bardir, bb.spin, q, cross); } // if(mark) { printf("mpdist = %d [%d] bardir = %d spin=%d q=%d cross=%d\n", bb.at->mpdist, BARLEV, bb.at->bardir, bb.spin, q, cross); }
@ -811,7 +811,7 @@ EX bool buildBarrier3D(cell *c, eLand l2, int forced_dir) {
} }
#endif #endif
EX bool buildBarrierNowall(cell *c, eLand l2, int forced_dir) { EX bool buildBarrierNowall(cell *c, eLand l2, int forced_dir IS(NODIR)) {
if(geometry == gBinary4) return false; if(geometry == gBinary4) return false;
#if MAXMDIM >= 4 #if MAXMDIM >= 4

View File

@ -4,7 +4,7 @@
namespace hr { namespace hr {
#if CAP_COMMANDLINE #if CAP_COMMANDLINE
const char *scorefile = "hyperrogue.log"; EX const char *scorefile = "hyperrogue.log";
namespace arg { namespace arg {
eLand readland(const string& ss) { eLand readland(const string& ss) {

View File

@ -24,7 +24,7 @@ EX videopar vid;
extern color_t floorcolors[landtypes]; extern color_t floorcolors[landtypes];
charstyle& getcs(int id) { EX charstyle& getcs(int id IS(multi::cpid)) {
if(multi::players>1 && id >= 0 && id < multi::players) if(multi::players>1 && id >= 0 && id < multi::players)
return multi::scs[id]; return multi::scs[id];
else else

View File

@ -19,8 +19,8 @@ EX int getcstat, lgetcstat;
ld getcshift; ld getcshift;
EX bool inslider; EX bool inslider;
function <void(int sym, int uni)> keyhandler = [] (int sym, int uni) {}; EX function <void(int sym, int uni)> keyhandler = [] (int sym, int uni) {};
function <bool(SDL_Event &ev)> joyhandler = [] (SDL_Event &ev) {return false;}; EX function <bool(SDL_Event &ev)> joyhandler = [] (SDL_Event &ev) {return false;};
// is the player using mouse? (used for auto-cross) // is the player using mouse? (used for auto-cross)
@ -40,12 +40,12 @@ EX ld mouseaim_sensitivity = 0.01;
EX int timetowait; EX int timetowait;
#if CAP_SDLJOY #if CAP_SDLJOY
int joyx, joyy, panjoyx, panjoyy; EX int joyx, joyy, panjoyx, panjoyy;
movedir joydir; EX movedir joydir;
#endif #endif
movedir mousedest; EX movedir mousedest;
ld shiftmul = 1; EX ld shiftmul = 1;
EX cell *mouseover, *mouseover2, *lmouseover; EX cell *mouseover, *mouseover2, *lmouseover;
ld modist, modist2, centdist; ld modist, modist2, centdist;
@ -181,8 +181,8 @@ EX void mousemovement() {
} }
#if CAP_SDLJOY #if CAP_SDLJOY
SDL_Joystick* sticks[8]; EX SDL_Joystick* sticks[8];
int numsticks; EX int numsticks;
EX void initJoysticks() { EX void initJoysticks() {
DEBB(DF_INIT, ("init joysticks")); DEBB(DF_INIT, ("init joysticks"));
@ -267,7 +267,7 @@ EX bool doexiton(int sym, int uni) {
return false; return false;
} }
bool didsomething; EX bool didsomething;
typedef SDL_Event eventtype; typedef SDL_Event eventtype;
@ -523,9 +523,13 @@ EX void handlekey(int sym, int uni) {
keyhandler(sym, uni); keyhandler(sym, uni);
} }
EX void resize_screen_to(int x, int y);
#if !CAP_SDL #if !CAP_SDL
EX void mainloopiter() { printf("(compiled without SDL -- no action)\n"); quitmainloop = true; } EX void mainloopiter() { printf("(compiled without SDL -- no action)\n"); quitmainloop = true; }
#else #endif
#if CAP_SDL
// Warning: a very long function! todo: refactor // Warning: a very long function! todo: refactor

View File

@ -3,10 +3,22 @@
namespace hr { namespace hr {
int steplimit = 0; EX int steplimit = 0;
int cstep; EX int cstep;
vector<cell*> buggycells; EX vector<cell*> buggycells;
#if HDR
template<class... T>
void limitgen(T... args) {
if(steplimit) {
cstep++;
printf("%6d ", cstep);
printf(args...);
if(cstep == steplimit) buggyGeneration = true;
}
}
#endif
cell *pathTowards(cell *pf, cell *pt) { cell *pathTowards(cell *pf, cell *pt) {
@ -302,7 +314,7 @@ template<class T> string dnameof2(T x, int p) {
return s + " (" + its(x) + "/" + its(p) + ")"; return s + " (" + its(x) + "/" + its(p) + ")";
} }
vector<pair<cellwalker,int> > drawbugs; EX vector<pair<cellwalker,int> > drawbugs;
bool debugmode = false; bool debugmode = false;
@ -456,14 +468,14 @@ struct debugScreen {
} }
}; };
void push_debug_screen() { EX void push_debug_screen() {
debugScreen ds; debugScreen ds;
pushScreen(ds); pushScreen(ds);
} }
// -- cheat menu -- // -- cheat menu --
void showCheatMenu() { EX void showCheatMenu() {
gamescreen(1); gamescreen(1);
dialog::init("cheat menu"); dialog::init("cheat menu");
dialog::addItem(XLAT("gain orb powers"), 'F'); dialog::addItem(XLAT("gain orb powers"), 'F');
@ -505,7 +517,7 @@ void showCheatMenu() {
}; };
} }
void viewall() { EX void viewall() {
celllister cl(cwt.at, 20, 2000, NULL); celllister cl(cwt.at, 20, 2000, NULL);
vector<eMonster> all_monsters; vector<eMonster> all_monsters;
@ -540,7 +552,7 @@ void viewall() {
} }
} }
void modalDebug(cell *c) { EX void modalDebug(cell *c) {
viewctr.at = c->master; viewctr.at = c->master;
if(noGUI) { if(noGUI) {
fprintf(stderr, "fatal: modalDebug called on %p without GUI\n", c); fprintf(stderr, "fatal: modalDebug called on %p without GUI\n", c);

View File

@ -1,8 +1,8 @@
namespace hr { namespace hr {
#if CAP_SHAPES #if CAP_SHAPES
vector<basic_textureinfo> floor_texture_vertices; EX vector<basic_textureinfo> floor_texture_vertices;
renderbuffer *floor_textures; EX renderbuffer *floor_textures;
void geometry_information::init_floorshapes() { void geometry_information::init_floorshapes() {
all_escher_floorshapes.clear(); all_escher_floorshapes.clear();

View File

@ -2924,8 +2924,8 @@ EX bool nogoSlow(cell *to, cell *from) {
} }
// pathdist begin // pathdist begin
cell *pd_from; EX cell *pd_from;
int pd_range; EX int pd_range;
EX void onpath(cell *c, int d) { EX void onpath(cell *c, int d) {
c->pathdist = d; c->pathdist = d;
@ -3014,6 +3014,27 @@ EX void computePathdist(eMonster param) {
} }
} }
} }
#if HDR
struct pathdata {
void checklock() {
if(pd_from) pd_from = NULL, clear_pathdata();
if(pathlock) printf("path error\n");
pathlock++;
}
~pathdata() {
pathlock--;
clear_pathdata();
}
pathdata(eMonster m) {
checklock();
computePathdist(m);
}
pathdata(int i) {
checklock();
}
};
#endif
// pathdist end // pathdist end
vector<pair<cell*, int> > butterflies; vector<pair<cell*, int> > butterflies;
@ -5113,8 +5134,8 @@ EX void movemutant() {
} }
} }
__typeof(shpos) shpos; EX vector<array<cell*, MAXPLAYER>> shpos;
int cshpos = 0; EX int cshpos = 0;
EX cell *lastmountpos[MAXPLAYER]; EX cell *lastmountpos[MAXPLAYER];

View File

@ -468,7 +468,7 @@ string current_proj_name() {
return XLAT("general perspective"); return XLAT("general perspective");
} }
void showEuclideanMenu() { EX void showEuclideanMenu() {
// for(int i=2; i<lt; i++) landvisited[i] = true; // for(int i=2; i<lt; i++) landvisited[i] = true;
cmode = sm::SIDE | sm::MAYDARK; cmode = sm::SIDE | sm::MAYDARK;

View File

@ -175,7 +175,7 @@ transmatrix xspinpush(ld dir, ld dist) {
return spin(dir) * xpush(dist) * spin(-dir); return spin(dir) * xpush(dist) * spin(-dir);
} }
purehookset hooks_swapdim; EX purehookset hooks_swapdim;
namespace geom3 { namespace geom3 {

View File

@ -66,7 +66,7 @@ EX transmatrix spintick(int period, ld phase IS(0)) {
int colorbar; int colorbar;
EX bool inHighQual; // taking high quality screenshot EX bool inHighQual; // taking high quality screenshot
bool auraNOGL; // aura without GL EX bool auraNOGL; // aura without GL
// //
int axestate; int axestate;
@ -77,10 +77,10 @@ int frameid;
bool camelotcheat; bool camelotcheat;
EX bool nomap; EX bool nomap;
eItem orbToTarget; EX eItem orbToTarget;
eMonster monsterToSummon; EX eMonster monsterToSummon;
int sightrange_bonus = 0; EX int sightrange_bonus = 0;
EX string mouseovers; EX string mouseovers;
@ -161,7 +161,7 @@ color_t fc(int ph, color_t col, int z) {
return col; return col;
} }
int lightat, safetyat; EX int lightat, safetyat;
EX void drawLightning() { lightat = ticks; } EX void drawLightning() { lightat = ticks; }
EX void drawSafety() { safetyat = ticks; } EX void drawSafety() { safetyat = ticks; }
@ -205,7 +205,7 @@ void drawSpeed(const transmatrix& V) {
#endif #endif
} }
int ctof(cell *c) { EX int ctof(cell *c) {
#if CAP_IRR #if CAP_IRR
if(IRREGULAR) return irr::ctof(c); if(IRREGULAR) return irr::ctof(c);
#endif #endif
@ -836,7 +836,7 @@ hpcshape& orbshape(eOrbshape s) {
} }
} }
bool drawItemType(eItem it, cell *c, const transmatrix& V, color_t icol, int pticks, bool hidden) { EX bool drawItemType(eItem it, cell *c, const transmatrix& V, color_t icol, int pticks, bool hidden) {
#if !CAP_SHAPES #if !CAP_SHAPES
return it; return it;
#else #else
@ -2298,7 +2298,7 @@ bool drawMonsterTypeDH(eMonster m, cell *where, const transmatrix& V, color_t co
return b; return b;
} }
transmatrix playerV; EX transmatrix playerV;
bool applyAnimation(cell *c, transmatrix& V, double& footphase, int layer) { bool applyAnimation(cell *c, transmatrix& V, double& footphase, int layer) {
if(!animations[layer].count(c)) return false; if(!animations[layer].count(c)) return false;
@ -2823,9 +2823,9 @@ bool drawMonster(const transmatrix& Vparam, int ct, cell *c, color_t col, bool m
return false; return false;
} }
cell *straightDownSeek; EX cell *straightDownSeek;
hyperpoint straightDownPoint; EX hyperpoint straightDownPoint;
ld straightDownSpeed; EX ld straightDownSpeed;
#define AURA 180 #define AURA 180
@ -2860,14 +2860,14 @@ void apply_joukowsky_aura(hyperpoint& h) {
} }
} }
void addauraspecial(hyperpoint h, color_t col, int dir) { EX void addauraspecial(hyperpoint h, color_t col, int dir) {
if(!haveaura()) return; if(!haveaura()) return;
apply_joukowsky_aura(h); apply_joukowsky_aura(h);
int r = int(2*AURA + dir + atan2(h[1], h[0]) * AURA / 2 / M_PI) % AURA; int r = int(2*AURA + dir + atan2(h[1], h[0]) * AURA / 2 / M_PI) % AURA;
auraspecials.emplace_back(r, col); auraspecials.emplace_back(r, col);
} }
void addaura(hyperpoint h, color_t col, int fd) { EX void addaura(hyperpoint h, color_t col, int fd) {
if(!haveaura()) return; if(!haveaura()) return;
apply_joukowsky_aura(h); apply_joukowsky_aura(h);
@ -3036,12 +3036,12 @@ bool bugsNearby(cell *c, int dist = 2) {
return false; return false;
} }
colortable minecolors = { EX colortable minecolors = {
0xFFFFFF, 0xF0, 0xF060, 0xF00000, 0xFFFFFF, 0xF0, 0xF060, 0xF00000,
0x60, 0x600000, 0x00C0C0, 0x000000, 0x808080, 0xFFD500 0x60, 0x600000, 0x00C0C0, 0x000000, 0x808080, 0xFFD500
}; };
colortable distcolors = { EX colortable distcolors = {
0xFFFFFF, 0xF0, 0xF060, 0xF00000, 0xFFFFFF, 0xF0, 0xF060, 0xF00000,
0xA0A000, 0xA000A0, 0x00A0A0, 0xFFD500 0xA0A000, 0xA000A0, 0x00A0A0, 0xFFD500
}; };
@ -3057,7 +3057,7 @@ const char* minetexts[8] = {
"Seven mines next to you!" "Seven mines next to you!"
}; };
int countMinesAround(cell *c) { EX int countMinesAround(cell *c) {
int mines = 0; int mines = 0;
for(cell *c2: adj_minefield_cells(c)) for(cell *c2: adj_minefield_cells(c))
if(c2->wall == waMineMine) if(c2->wall == waMineMine)
@ -5017,7 +5017,7 @@ void drawcell_in_radar(cell *c, transmatrix V) {
} }
#endif #endif
void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) { EX void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
PROD( if(product::pmap) { product::drawcell_stack(c, V, spinv, mirrored); return; } ) PROD( if(product::pmap) { product::drawcell_stack(c, V, spinv, mirrored); return; } )
@ -6824,13 +6824,13 @@ EX void queuecircleat(cell *c, double rad, color_t col) {
#define MOBON true #define MOBON true
#endif #endif
cell *forwardcell() { EX cell *forwardcell() {
movedir md = vectodir(move_destination_vec(6)); movedir md = vectodir(move_destination_vec(6));
cellwalker xc = cwt + md.d + wstep; cellwalker xc = cwt + md.d + wstep;
return xc.at; return xc.at;
} }
void drawMarkers() { EX void drawMarkers() {
if(!(cmode & sm::NORMAL)) return; if(!(cmode & sm::NORMAL)) return;
@ -7092,7 +7092,7 @@ void drawFlashes() {
#endif #endif
} }
bool allowIncreasedSight() { EX bool allowIncreasedSight() {
if(cheater || autocheat) return true; if(cheater || autocheat) return true;
if(peace::on) return true; if(peace::on) return true;
#if CAP_TOUR #if CAP_TOUR
@ -7105,7 +7105,7 @@ bool allowIncreasedSight() {
return false; return false;
} }
bool allowChangeRange() { EX bool allowChangeRange() {
if(cheater || peace::on || randomPatternsMode) return true; if(cheater || peace::on || randomPatternsMode) return true;
#if CAP_TOUR #if CAP_TOUR
if(tour::on) return true; if(tour::on) return true;
@ -7117,11 +7117,11 @@ bool allowChangeRange() {
return false; return false;
} }
purehookset hooks_drawmap; EX purehookset hooks_drawmap;
transmatrix actual_view_transform; EX transmatrix actual_view_transform;
ld wall_radar(cell *c, transmatrix T, ld max) { EX ld wall_radar(cell *c, transmatrix T, ld max) {
if(pmodel != mdPerspective || !vid.use_wall_radar) return max; if(pmodel != mdPerspective || !vid.use_wall_radar) return max;
ld step = max / 20; ld step = max / 20;
ld fixed_yshift = 0; ld fixed_yshift = 0;
@ -7139,7 +7139,7 @@ ld wall_radar(cell *c, transmatrix T, ld max) {
return fixed_yshift; return fixed_yshift;
} }
void make_actual_view() { EX void make_actual_view() {
sphereflip = Id; sphereflip = Id;
if(sphereflipped()) sphereflip[DIM][DIM] = -1; if(sphereflipped()) sphereflip[DIM][DIM] = -1;
actual_view_transform = sphereflip; actual_view_transform = sphereflip;
@ -7160,7 +7160,7 @@ void make_actual_view() {
#endif #endif
} }
transmatrix cview() { EX transmatrix cview() {
make_actual_view(); make_actual_view();
#if MAXMDIM >= 4 #if MAXMDIM >= 4
if(GDIM == 3 && WDIM == 2) { if(GDIM == 3 && WDIM == 2) {
@ -7182,7 +7182,7 @@ transmatrix cview() {
return actual_view_transform * View; return actual_view_transform * View;
} }
void precise_mouseover() { EX void precise_mouseover() {
if(WDIM == 3) { if(WDIM == 3) {
mouseover2 = mouseover = viewctr.at->c7; mouseover2 = mouseover = viewctr.at->c7;
ld best = HUGE_VAL; ld best = HUGE_VAL;
@ -7686,7 +7686,7 @@ EX void normalscreen() {
vector< function<void()> > screens = { normalscreen }; vector< function<void()> > screens = { normalscreen };
int cmode; EX int cmode;
EX void drawscreen() { EX void drawscreen() {
@ -7927,7 +7927,7 @@ EX void animateReplacement(cell *a, cell *b, int layer, int direction_hinta, int
animateMovement(&c1, a, layer, direction_hintb); animateMovement(&c1, a, layer, direction_hintb);
} }
void drawBug(const cellwalker& cw, color_t col) { EX void drawBug(const cellwalker& cw, color_t col) {
#if CAP_SHAPES #if CAP_SHAPES
initquickqueue(); initquickqueue();
transmatrix V = ggmatrix(cw.at); transmatrix V = ggmatrix(cw.at);

View File

@ -86,7 +86,7 @@ void updatesort() {
glyph_lastticks = ticks; glyph_lastticks = ticks;
} }
void preparesort() { EX void preparesort() {
for(int i=0; i<glyphs; i++) glyphorder[i] = i; for(int i=0; i<glyphs; i++) glyphorder[i] = i;
for(int i=0; i<isize(land_over); i++) { for(int i=0; i<isize(land_over); i++) {
eLand l = land_over[i]; eLand l = land_over[i];

View File

@ -40,9 +40,10 @@ void moreStack() {
} }
#endif #endif
hr::hookset<bool(int argc, char** argv)> *hr::hooks_main; namespace hr {
EX hookset<bool(int argc, char** argv)> *hooks_main;
int hyper_main(int argc, char **argv) { EX int hyper_main(int argc, char **argv) {
using namespace hr; using namespace hr;
#if ISWEB #if ISWEB
emscripten_get_commandline(); emscripten_get_commandline();
@ -76,10 +77,11 @@ int hyper_main(int argc, char **argv) {
profile_info(); profile_info();
return 0; return 0;
} }
}
#ifndef NOMAIN #ifndef NOMAIN
int main(int argc, char **argv) { int main(int argc, char **argv) {
return hyper_main(argc, argv); return hr::hyper_main(argc, argv);
} }
#endif #endif
#endif #endif

656
hyper.h
View File

@ -1538,17 +1538,12 @@ void useup(cell *c); // useup thumpers/bonfires
cell *playerpos(int i); cell *playerpos(int i);
bool makeflame(cell *c, int timeout, bool checkonly); bool makeflame(cell *c, int timeout, bool checkonly);
void bfs();
bool isPlayerInBoatOn(cell *c); bool isPlayerInBoatOn(cell *c);
bool isPlayerInBoatOn(cell *c, int i); bool isPlayerInBoatOn(cell *c, int i);
void destroyBoats(cell *c, cell *cf, bool strandedToo); void destroyBoats(cell *c, cell *cf, bool strandedToo);
extern bool showoff;
extern int lastexplore; extern int lastexplore;
extern int truelotus;
extern int asteroids_generated, asteroid_orbs_generated; extern int asteroids_generated, asteroid_orbs_generated;
extern eLand lastland; extern eLand lastland;
extern time_t timerstart;
extern bool timerstopped;
bool againstRose(cell *cfrom, cell *cto); bool againstRose(cell *cfrom, cell *cto);
bool withRose(cell *cfrom, cell *cto); bool withRose(cell *cfrom, cell *cto);
@ -2004,18 +1999,7 @@ color_t darkena(color_t c, int lev, int a);
#define SHSIZE 16 #define SHSIZE 16
namespace anims { void animate_parameter(ld &x, string f, const reaction_t& r); }
extern vector<array<cell*, MAXPLAYER>> shpos;
extern int cshpos;
#if CAP_ANIMATIONS
namespace anims {
void animate_parameter(ld &x, string f, const reaction_t& r);
void deanimate(ld &x);
void get_parameter_animation(ld &x, string& f);
extern ld a, b;
}
#endif
extern bool timerghost; extern bool timerghost;
@ -2211,35 +2195,9 @@ extern char mousekey;
extern char newmousekey; extern char newmousekey;
void displaymm(char c, int x, int y, int rad, int size, const string& title, int align); void displaymm(char c, int x, int y, int rad, int size, const string& title, int align);
bool canPushThumperOn(cell *tgt, cell *thumper, cell *player);
void pushThumper(cell *th, cell *cto);
template<class T, class... U> T pick(T x, U... u) { std::initializer_list<T> i = {x,u...}; return *(i.begin() + hrand(1+sizeof...(u))); } template<class T, class... U> T pick(T x, U... u) { std::initializer_list<T> i = {x,u...}; return *(i.begin() + hrand(1+sizeof...(u))); }
eLand getNewSealand(eLand old);
bool createOnSea(eLand old);
namespace inv {
extern bool on;
extern bool usedForbidden;
extern bool activating;
extern array<int, ittypes> remaining;
extern array<int, ittypes> usedup;
void compute();
void applyBox(eItem it);
extern int incheck;
void check(int delta);
void show();
}
bool drawItemType(eItem it, cell *c, const transmatrix& V, color_t icol, int ticks, bool hidden);
int darkenedby(int c, int lev); int darkenedby(int c, int lev);
extern int mousex, mousey;
#if CAP_MOUSEGRAB
extern ld mouseaim_x, mouseaim_y;
#endif
extern ld mouseaim_sensitivity; extern ld mouseaim_sensitivity;
string generateHelpForItem(eItem it); string generateHelpForItem(eItem it);
bool graphglyph(); bool graphglyph();
@ -2258,9 +2216,6 @@ template<class T, class U> int addHook(hookset<T>*& m, int prio, const U& hook)
return 0; return 0;
} }
extern purehookset hooks_frame, hooks_stats, clearmemory, hooks_config, hooks_tests, hooks_removecells, hooks_initgame, hooks_calcparam, hooks_mainmenu, hooks_startmenu, hooks_markers;
extern purehookset hooks_swapdim;
template<class T, class... U> void callhooks(hookset<T> *h, U... args) { template<class T, class... U> void callhooks(hookset<T> *h, U... args) {
if(h) for(auto& p: *h) p.second(args...); if(h) for(auto& p: *h) p.second(args...);
} }
@ -2273,20 +2228,6 @@ template<class T, class V, class... U> V callhandlers(V zero, hookset<T> *h, U&.
return zero; return zero;
} }
extern hookset<bool(int sym, int uni)> *hooks_handleKey;
extern hookset<bool(cell *c, const transmatrix& V)> *hooks_drawcell;
extern hookset<bool(int argc, char** argv)> *hooks_main;
extern hookset<int()> *hooks_args;
extern hookset<bool(cell*)> *hooks_mark;
extern hookset<eLand(eLand)> *hooks_nextland;
extern hookset<bool()> *hooks_welcome_message, *hooks_default_help;
extern hookset<void(cell*)> *hooks_mouseover;
extern hookset<struct hrmap*()> *hooks_newmap;
extern ld shiftmul;
void initcs(charstyle &cs);
charstyle& getcs(int id = multi::cpid);
struct msginfo { struct msginfo {
int stamp; int stamp;
time_t rtstamp; time_t rtstamp;
@ -2298,11 +2239,6 @@ struct msginfo {
string msg; string msg;
}; };
extern vector<msginfo> msgs;
void flashMessages();
extern int lightat, safetyat;
int watercolor(int phase); int watercolor(int phase);
bool doHighlight(); bool doHighlight();
void buildHelpText(); void buildHelpText();
@ -2312,12 +2248,8 @@ bool quitsaves();
extern const char* COLORBAR; extern const char* COLORBAR;
int textwidth(int siz, const string &str);
#define GLERR(call) glError(call, __FILE__, __LINE__) #define GLERR(call) glError(call, __FILE__, __LINE__)
extern bool gtouched, mousepressed, mousemoved, actonrelease;
extern bool inslider;
struct colortable: vector<color_t> { struct colortable: vector<color_t> {
color_t& operator [] (int i) { i %= size(); if(i<0) i += size(); return ((vector<color_t>&)(*this)) [i]; } color_t& operator [] (int i) { i %= size(); if(i<0) i += size(); return ((vector<color_t>&)(*this)) [i]; }
const color_t& operator [] (int i) const { i %= size(); if(i<0) i += size(); return ((vector<color_t>&)(*this)) [i]; } const color_t& operator [] (int i) const { i %= size(); if(i<0) i += size(); return ((vector<color_t>&)(*this)) [i]; }
@ -2325,84 +2257,15 @@ struct colortable: vector<color_t> {
colortable() : vector({0}) {} colortable() : vector({0}) {}
}; };
extern bool outoffocus;
extern int frames;
extern transmatrix playerV;
extern bool didsomething;
extern void drawStats();
extern int calcfps();
extern colortable distcolors, minecolors;
extern eItem orbToTarget;
extern eMonster monsterToSummon;
void panning(hyperpoint hf, hyperpoint ht);
extern transmatrix sphereflip;
void initConfig();
void loadConfig();
extern bool auraNOGL;
#if CAP_SDLJOY
extern void initJoysticks();
extern bool autojoy;
extern int joyx, joyy, panjoyx, panjoyy;
extern movedir joydir;
extern SDL_Joystick* sticks[8];
extern int numsticks;
void closeJoysticks();
#endif
void preparesort();
#define SHMUPTITLE "shoot'em up mode" #define SHMUPTITLE "shoot'em up mode"
bool dodrawcell(cell *c);
void drawcell(cell *c, transmatrix V, int spinv, bool mirrored);
extern cell* straightDownSeek;
extern hyperpoint straightDownPoint;
extern ld straightDownSpeed;
extern int frameid;
extern bool leftclick;
void clearMemory();
extern function <void(int sym, int uni)> keyhandler;
#if CAP_SDL
extern function <bool(SDL_Event &ev)> joyhandler;
#endif
bool gmodekeys(int sym, int uni);
// check for a plain number key // check for a plain number key
#define NUMBERKEY (interpret_as_direction(sym, uni) ? 0 : uni) #define NUMBERKEY (interpret_as_direction(sym, uni) ? 0 : uni)
#define DKEY (get_direction_key(sym, uni)) #define DKEY (get_direction_key(sym, uni))
#define DIRECTIONKEY (interpret_as_direction(sym, uni) ? uni : 0) #define DIRECTIONKEY (interpret_as_direction(sym, uni) ? uni : 0)
bool interpret_as_direction(int sym, int uni);
int get_direction_key(int sym, int uni);
void switchGL();
void switchFullscreen();
extern int cmode;
namespace scores { void load(); } namespace scores { void load(); }
void gotoHelp(const string& h);
void showCustomizeChar();
void showCheatMenu();
void showGraphQuickKeys();
void showChangeMode();
void showEuclideanMenu();
void show3D();
void gameoverscreen();
void showJoyConfig();
void gamescreen(int darken);
void showMission();
void handleKeyQuit(int sym, int uni);
void handlePanning(int sym, int uni);
#if ISMOBILE==1 #if ISMOBILE==1
namespace leader { void showMenu(); void handleKey(int sym, int uni); } namespace leader { void showMenu(); void handleKey(int sym, int uni); }
#endif #endif
@ -2411,19 +2274,6 @@ namespace mirror {
cellwalker reflect(const cellwalker& cw); cellwalker reflect(const cellwalker& cw);
} }
bool inmirror(eLand l);
bool inmirror(cell *c);
bool inmirror(const cellwalker& cw);
void check_total_victory();
void applyBoxNum(int& i, string name = "");
extern int hinttoshow;
bool isShmupLifeOrb(eItem it);
int orbcharges(eItem it);
color_t gradient(color_t c0, color_t c1, ld v0, ld v, ld v1);
struct hint { struct hint {
time_t last; time_t last;
function<bool()> usable; function<bool()> usable;
@ -2434,8 +2284,6 @@ struct hint {
extern hint hints[]; extern hint hints[];
int counthints(); int counthints();
void gainShard(cell *c2, const char *msg);
int textwidth(int siz, const string &str); int textwidth(int siz, const string &str);
#if CAP_GL #if CAP_GL
int gl_width(int size, const char *s); int gl_width(int size, const char *s);
@ -2447,22 +2295,6 @@ extern bool longclick;
extern bool useRangedOrb; extern bool useRangedOrb;
#endif #endif
void addaura(hyperpoint h, color_t col, int fd);
void addauraspecial(hyperpoint h, color_t col, int dir);
void drawaura();
void clearaura();
void drawBug(const cellwalker& cw, color_t col);
void mainloop();
void mainloopiter();
extern bool showstartmenu;
void selectLanguageScreen();
bool inscreenrange(cell *c);
bool allowIncreasedSight();
bool allowChangeRange();
static inline bool orbProtection(eItem it) { return false; } // not implemented static inline bool orbProtection(eItem it) { return false; } // not implemented
#if CAP_FIELD #if CAP_FIELD
@ -2479,70 +2311,10 @@ namespace windmap {
extern int wavephase; extern int wavephase;
void buildEquidistant(cell *c);
void produceGhost(cell *c, eMonster victim, eMonster who);
void sideAttack(cell *mf, int dir, eMonster who, int bonus, eItem orb);
void sideAttack(cell *mf, int dir, eMonster who, int bonuskill);
void orboflava(int i);
void setland(cell *c, eLand l);
eLand getNewLand(eLand old);
extern bool randomPatternsMode;
extern int isRandland(eLand l);
extern vector<cell*> buggycells;
extern bool landUnlocked(eLand l);
extern void describeCell(cell*);
extern bool rlyehComplete();
extern int steplimit, cstep;
template<class... T>
void limitgen(T... args) {
if(steplimit) {
cstep++;
printf("%6d ", cstep);
printf(args...);
if(cstep == steplimit) buggyGeneration = true;
}
}
eLand oppositeElement(eLand l, eLand l2);
extern int hardness_empty();
extern eWall getElementalWall(eLand l);
void gainItem(eItem it);
void destroyTrapsOn(cell *c);
void destroyTrapsAround(cell *c);
extern int messagelogpos;
void showMessageLog();
int getgametime(); int getgametime();
string getgametime_s(int timespent = getgametime()); string getgametime_s(int timespent = getgametime());
extern int stampbase; extern int stampbase;
transmatrix cellrelmatrix(cell *c, int i);
void terracottaAround(cell *c);
double cellgfxdist(cell *c, int i);
int ctof(cell *c);
void modalDebug(cell *c);
void push_debug_screen();
int getDistLimit();
#ifndef GL #ifndef GL
typedef float GLfloat; typedef float GLfloat;
#endif #endif
@ -2666,49 +2438,9 @@ extern int emeraldtable[100][7];
const eLand NOWALLSEP = laNone; const eLand NOWALLSEP = laNone;
const eLand NOWALLSEP_USED = laWhirlpool; const eLand NOWALLSEP_USED = laWhirlpool;
bool hasbardir(cell *c);
bool buildBarrierNowall(cell *c, eLand l2, int forced_dir = NODIR);
bool checkBarriersBack(cellwalker bb, int q=5, bool cross = false);
bool checkBarriersFront(cellwalker bb, int q=5, bool cross = false);
bool quickfind(eLand l);
void beCIsland(cell *c);
bool isOnCIsland(cell *c);
void generateTreasureIsland(cell *c);
bool openplains(cell *c);
void buildBigStuff(cell *c, cell *from);
void setLandQuotient(cell *c);
void setLandSphere(cell *c);
void setLandWeird(cell *c);
void moreBigStuff(cell *c);
void setLandEuclid(cell *c);
void setLandSol(cell *c);
void setLandNil(cell *c);
bool checkInTree(cell *c, int maxv);
cell *findcompass(cell *c);
int edgeDepth(cell *c);
int compassDist(cell *c);
void buildCamelot(cell *c);
#define HAUNTED_RADIUS getDistLimit() #define HAUNTED_RADIUS getDistLimit()
#define UNKNOWN 65535 #define UNKNOWN 65535
#if CAP_COMMANDLINE
extern const char *scorefile;
extern string levelfile;
extern string picfile;
extern const char *conffile;
extern const char *musicfile;
#endif
extern string s0;
extern int anthraxBonus;
int celldistAlt(cell *c);
int celldist(cell *c);
int masterAlt(cell *c);
int getHemisphere(cell *c, int which);
namespace tactic { namespace tactic {
extern bool on; extern bool on;
extern bool trailer; extern bool trailer;
@ -2798,16 +2530,6 @@ namespace princess {
#define GRAIL_FOUND 0x4000 #define GRAIL_FOUND 0x4000
#define GRAIL_RADIUS_MASK 0x3FFF #define GRAIL_RADIUS_MASK 0x3FFF
int eudist(int sx, int sy);
bool ishept(cell *c);
int cdist50(cell *c);
bool polarb50(cell *c);
bool isGravityLand(eLand l);
bool isWarpedType(eLand l);
bool isWarped(cell *c);
struct hrmap { struct hrmap {
virtual heptagon *getOrigin() { return NULL; } virtual heptagon *getOrigin() { return NULL; }
virtual cell *gamestart() { return getOrigin()->c7; } virtual cell *gamestart() { return getOrigin()->c7; }
@ -2862,35 +2584,6 @@ struct hrmap_hyperbolic : hrmap_standard {
void verify() override { verifycells(origin); } void verify() override { verifycells(origin); }
}; };
namespace irr {
#if CAP_IRR
extern ld density;
extern ld quality;
extern int cellcount;
extern int place_attempts;
extern int rearrange_max_attempts;
extern int rearrange_less;
extern int irrid;
void link_to_base(heptagon *h, heptspin base);
void link_start(heptagon *h);
void link_next(heptagon *h, int d);
void may_link_next(heptagon *h, int d);
void link_cell(cell *c, int d);
void clear_links(heptagon *h);
bool pseudohept(cell*);
array<heptagon*, 3> get_masters(cell *c);
bool ctof(cell* c);
bool supports(eGeometry g);
void visual_creator();
unsigned char density_code();
int celldist(cell *c, bool alts);
extern int bitruncations_requested, bitruncations_performed;
#endif
}
extern hrmap *currentmap;
extern vector<hrmap*> allmaps;
// list all cells in distance at most maxdist, or until when maxcount cells are reached // list all cells in distance at most maxdist, or until when maxcount cells are reached
struct manual_celllister { struct manual_celllister {
@ -2959,11 +2652,6 @@ int currfp_get_R();
int currfp_get_X(); int currfp_get_X();
#endif #endif
const char *dnameof(eMonster m);
const char *dnameof(eLand l);
const char *dnameof(eWall w);
const char *dnameof(eItem i);
void runGeometryExperiments(); void runGeometryExperiments();
// z to close to this limit => do not draw // z to close to this limit => do not draw
@ -3000,9 +2688,7 @@ bool haveMobileCompass();
bool handleCompass(); bool handleCompass();
inline bool sphereflipped() { return sphere && vid.alpha > 1.1 && DIM == 3; } inline bool sphereflipped() { return sphere && vid.alpha > 1.1 && DIM == 3; }
bool hide_player();
int cellcolor(cell *c); int cellcolor(cell *c);
transmatrix screenpos(ld x, ld y);
extern ld backbrightness; extern ld backbrightness;
void initcells(); void initcells();
@ -3023,22 +2709,12 @@ extern const char *musicfile;
extern const char *loadlevel; extern const char *loadlevel;
#endif #endif
transmatrix spin(ld alpha);
transmatrix xpush(ld alpha);
transmatrix inverse(const transmatrix&);
ld hdist(const hyperpoint& h1, const hyperpoint& h2);
extern bool fixseed; extern bool fixseed;
extern eLand firstland0; extern eLand firstland0;
extern int startseed; extern int startseed;
// heptspin hsstep(const heptspin &hs, int spin); // heptspin hsstep(const heptspin &hs, int spin);
extern void fixmatrix(transmatrix&);
transmatrix rgpushxto0(const hyperpoint& H);
string its(int i);
ld hdist0(const hyperpoint& mh); ld hdist0(const hyperpoint& mh);
extern bool fading; extern bool fading;
@ -3051,8 +2727,6 @@ extern hookset<bool(eLand&)> *hooks_music;
extern hookset<bool()> *hooks_prestats; extern hookset<bool()> *hooks_prestats;
extern purehookset hooks_fixticks; extern purehookset hooks_fixticks;
ld realradius();
void sdltogl(SDL_Surface *txt, struct glfont_t& f, int ch); void sdltogl(SDL_Surface *txt, struct glfont_t& f, int ch);
void showStartMenu(); void showStartMenu();
@ -3072,133 +2746,6 @@ int snake_pair(cell *c);
extern colortable nestcolors; extern colortable nestcolors;
#if CAP_TEXTURE
namespace texture {
enum eTextureState {
tsOff, tsAdjusting, tsActive
};
struct texture_data {
GLuint textureid;
int twidth;
int tx, ty, origdim;
texture_data() { textureid = 0; twidth = 2048; }
vector<color_t> texture_pixels;
color_t& get_texture_pixel(int x, int y) {
return texture_pixels[(y&(twidth-1))*twidth+(x&(twidth-1))];
}
vector<pair<color_t*, color_t>> undos;
vector<tuple<cell*, hyperpoint, int> > pixels_to_draw;
bool loadTextureGL();
bool whitetexture();
bool readtexture(string tn);
void saveRawTexture(string tn);
void undo();
void undoLock();
void update();
};
struct texture_config {
string texturename;
string configname;
color_t paint_color;
eTextureState tstate;
eTextureState tstate_max;
transmatrix itt;
color_t grid_color;
color_t mesh_color;
color_t master_color;
color_t slave_color;
int color_alpha;
int gsplits;
int recolor(color_t col);
typedef tuple<eGeometry, eVariation, char, int, eModel, ld, ld> texture_parameters;
texture_parameters orig_texture_parameters;
map<int, textureinfo> texture_map, texture_map_orig;
set<cell*> models;
basic_textureinfo tinf3;
bool texture_tuned;
string texture_tuner;
vector<hyperpoint*> tuned_vertices;
bool apply(cell *c, const transmatrix &V, color_t col);
void mark_triangles();
void clear_texture_map();
void perform_mapping();
void mapTextureTriangle(textureinfo &mi, const array<hyperpoint, 3>& v, const array<hyperpoint, 3>& tv, int splits);
void mapTextureTriangle(textureinfo &mi, const array<hyperpoint, 3>& v, const array<hyperpoint, 3>& tv) { mapTextureTriangle(mi, v, tv, gsplits); }
void mapTexture2(textureinfo& mi);
void finish_mapping();
void true_remap();
void remap();
bool correctly_mapped;
hyperpoint texture_coordinates(hyperpoint);
void drawRawTexture();
void saveFullTexture(string tn);
bool save();
bool load();
texture_data data;
texture_config() {
// argh, no member initialization in some of my compilers
texturename = "textures/hyperrogue-texture.png";
configname = "textures/hyperrogue.txc";
itt = Id;
paint_color = 0x000000FF;
grid_color = 0;
mesh_color = 0;
master_color = 0xFFFFFF30;
slave_color = 0xFF000008;
color_alpha = 128;
gsplits = 1;
texture_tuned = false;
}
};
extern texture_config config;
extern ld penwidth;
extern bool saving;
void showMenu();
void drawPixel(cell *c, hyperpoint h, color_t col);
extern cell *where;
// compute 'c' automatically, based on the hint in 'where'
void drawPixel(hyperpoint h, color_t col);
void drawLine(hyperpoint h1, hyperpoint h2, color_t col, int steps = 10);
extern bool texturesym;
extern cpatterntype cgroup;
extern bool texture_aura;
bool using_aura();
void start_editor();
}
#endif
unsigned char& part(color_t& col, int i); unsigned char& part(color_t& col, int i);
transmatrix applyPatterndir(cell *c, const patterns::patterninfo& si); transmatrix applyPatterndir(cell *c, const patterns::patterninfo& si);
@ -3251,8 +2798,6 @@ void fullcenter();
void mainloop(); void mainloop();
void clearAnimations(); void clearAnimations();
transmatrix rotmatrix(double rotation, int c0, int c1);
void destroycellcontents(cell *c); void destroycellcontents(cell *c);
extern heptagon *last_cleared; extern heptagon *last_cleared;
@ -3265,41 +2810,6 @@ template<class T, class U> void eliminate_if(vector<T>& data, U pred) {
bool is_cell_removed(cell *c); bool is_cell_removed(cell *c);
void set_if_removed(cell*& c, cell *val); void set_if_removed(cell*& c, cell *val);
struct renderbuffer {
bool valid;
int x, y;
#if CAP_GL
int tx, ty;
GLuint FramebufferName;
GLuint renderedTexture;
GLuint depth_stencil_rb;
Uint32 *expanded_data;
void use_as_texture();
#endif
#if CAP_SDL
SDL_Surface *srf;
void make_surface();
SDL_Surface *render();
#endif
renderbuffer(int x, int y, bool gl);
~renderbuffer();
void enable();
void clear(color_t col);
};
extern renderbuffer *floor_textures;
struct resetbuffer {
GLint drawFboId, readFboId;
SDL_Surface *sreset;
resetbuffer();
void reset();
};
double randd();
#if CAP_ORIENTATION #if CAP_ORIENTATION
transmatrix getOrientation(); transmatrix getOrientation();
#endif #endif
@ -3338,28 +2848,6 @@ template<class T> array<T, 2> make_array(T a, T b) { array<T,2> x; x[0] = a; x[1
extern const hyperpoint Hypc; extern const hyperpoint Hypc;
#if CAP_SURFACE
namespace surface {
enum eShape { dsNone, dsTractricoid, dsDini, dsKuen, dsHyperlike, dsHyperboloid, dsHemisphere, dsCrystal };
extern eShape sh;
void show_surfaces();
void run_shape(eShape);
extern ld hyper_b, dini_b;
}
#endif
struct stringpar {
string v;
stringpar(string s) : v(s) { }
stringpar(const char* s) : v(s) { }
stringpar(eMonster m) { v= minf[m].name; }
stringpar(eLand l) { v= linf[l].name; }
stringpar(eWall w) { v= winf[w].name; }
stringpar(eItem i) { v= iinf[i].name; }
};
namespace gp { namespace gp {
typedef pair<int, int> loc; typedef pair<int, int> loc;
@ -3505,87 +2993,6 @@ template<> struct saver<ld> : dsaver<ld> {
#endif #endif
namespace glhr {
struct glmatrix {
GLfloat a[4][4];
GLfloat* operator[] (int i) { return a[i]; }
const GLfloat* operator[] (int i) const { return a[i]; }
GLfloat* as_array() { return a[0]; }
const GLfloat* as_array() const { return a[0]; }
};
enum class shader_projection { standard, band, halfplane, standardH3, standardR3,
standardS30, standardS31, standardS32, standardS33,
ball, halfplane3, band3, flatten, standardSolv, standardNil,
MAX
};
extern shader_projection new_shader_projection;
glmatrix tmtogl(const transmatrix& T);
void set_depthtest(bool b);
glmatrix translate(ld x, ld y, ld z);
void color2(color_t color, ld scale = 1);
void be_nontextured(shader_projection sp = new_shader_projection);
void be_textured(shader_projection sp = new_shader_projection);
void use_projection(shader_projection sp = new_shader_projection);
void set_modelview(const glmatrix& m);
hyperpoint gltopoint(const glvertex& t);
glvertex pointtogl(const hyperpoint& t);
inline glvertex makevertex(GLfloat x, GLfloat y, GLfloat z) {
#if SHDIM == 3
return make_array(x, y, z);
#else
return make_array<GLfloat>(x, y, z, 1);
#endif
}
struct colored_vertex {
glvertex coords;
glvec4 color;
colored_vertex(GLfloat x, GLfloat y, GLfloat r, GLfloat g, GLfloat b) {
coords[0] = x;
coords[1] = y;
coords[2] = current_display->scrdist;
coords[3] = 1;
color[0] = r;
color[1] = g;
color[2] = b;
color[3] = 1;
}
colored_vertex(hyperpoint h, color_t col) {
coords = pointtogl(h);
for(int i=0; i<4; i++)
color[i] = part(col, 3-i) / 255.0;
}
};
struct textured_vertex {
glvertex coords;
glvec2 texture;
};
struct ct_vertex {
glvertex coords;
glvec4 color;
glvec2 texture;
ct_vertex(const hyperpoint& h, ld x1, ld y1, ld col) {
coords = pointtogl(h);
texture[0] = x1;
texture[1] = y1;
color[0] = color[1] = color[2] = col;
color[3] = 1;
}
};
void prepare(vector<textured_vertex>& v);
void prepare(vector<colored_vertex>& v);
void prepare(vector<ct_vertex>& v);
}
#if CAP_SHAPES #if CAP_SHAPES
struct floorshape; struct floorshape;
@ -3613,26 +3020,6 @@ struct hpcshape {
extern vector<hpcshape> shPlainWall3D, shWireframe3D, shWall3D, shMiniWall3D; extern vector<hpcshape> shPlainWall3D, shWireframe3D, shWall3D, shMiniWall3D;
#endif #endif
cell *newCell(int type, heptagon *master);
extern color_t qpixel_pixel_outside;
int zebra3(cell *c);
int geosupport_threecolor();
int geosupport_football();
bool geosupport_chessboard();
bool ishex1(cell *c);
namespace fieldpattern { int fieldval_uniq(cell *c); int fieldval_uniq_rand(cell *c, int d); }
bool warptype(cell *c);
bool horo_ok();
bool deep_ocean_at(cell *c, cell *from);
int wallchance(cell *c, bool deepOcean);
ld master_to_c7_angle();
void resize_screen_to(int x, int y);
extern bool canvas_invisible;
extern cell *pd_from;
namespace daily { namespace daily {
extern bool on; extern bool on;
extern int daily_id; extern int daily_id;
@ -3647,27 +3034,6 @@ namespace daily {
void uploadscore(bool really_final); void uploadscore(bool really_final);
} }
enum eOrbLandRelation {
olrForbidden, // never appears: forbidden
olrDangerous, // never appears: would be dangerous
olrUseless, // never appears: useless here
olrNoPrizes, // no prizes in this land
olrNoPrizeOrb,// orb not allowed as a prize
olrPrize25, // prize for collecting 25
olrPrize3, // prize for collecting 3
olrNative, // native orb in this land
olrNative1, // native orb in this land (1)
olrGuest, // extra orb in this land
olrPNative, // Land of Power: native
olrPBasic, // Land of Power: basic orbs
olrPPrized, // Land of Power: prized orbs
olrPNever, // Land of Power: foreign orbs
olrHub, // hub lands
olrMonster, // available from a monster
olrAlways, // always available
olrBurns // burns
};
namespace torusconfig { namespace torusconfig {
extern int sdx, sdy; extern int sdx, sdy;
@ -3731,7 +3097,6 @@ namespace fieldpattern {
#endif #endif
bool incompatible(eLand l1, eLand l2); bool incompatible(eLand l1, eLand l2);
eOrbLandRelation getOLR(eItem it, eLand l);
struct plainshape; struct plainshape;
void clear_plainshape(plainshape& gsh); void clear_plainshape(plainshape& gsh);
@ -4127,25 +3492,6 @@ extern void computePathdist(eMonster m);
extern void onpath(cell *c, int d); extern void onpath(cell *c, int d);
extern void clear_pathdata(); extern void clear_pathdata();
struct pathdata {
void checklock() {
if(pd_from) pd_from = NULL, clear_pathdata();
if(pathlock) printf("path error\n");
pathlock++;
}
~pathdata() {
pathlock--;
clear_pathdata();
}
pathdata(eMonster m) {
checklock();
computePathdist(m);
}
pathdata(int i) {
checklock();
}
};
extern int timetowait; extern int timetowait;
#define RING(i) for(double i=0; i<=cgi.S84+1e-6; i+=SD3 * pow(.5, vid.linequality)) #define RING(i) for(double i=0; i<=cgi.S84+1e-6; i+=SD3 * pow(.5, vid.linequality))

View File

@ -851,11 +851,11 @@ ld spherity(const transmatrix& V) {
return spherity(tC0(V)); return spherity(tC0(V));
} }
bool confusingGeometry() { EX bool confusingGeometry() {
return quotient; return quotient;
} }
ld master_to_c7_angle() { EX ld master_to_c7_angle() {
ld alpha = 0; ld alpha = 0;
#if CAP_GP #if CAP_GP
if(cgi.gpdata) alpha = cgi.gpdata->alpha; if(cgi.gpdata) alpha = cgi.gpdata->alpha;
@ -863,7 +863,7 @@ ld master_to_c7_angle() {
return (!BITRUNCATED && !binarytiling && !archimedean) ? M_PI + alpha : 0; return (!BITRUNCATED && !binarytiling && !archimedean) ? M_PI + alpha : 0;
} }
transmatrix actualV(const heptspin& hs, const transmatrix& V) { EX transmatrix actualV(const heptspin& hs, const transmatrix& V) {
if(WDIM == 3) return V; if(WDIM == 3) return V;
#if CAP_IRR #if CAP_IRR
if(IRREGULAR) if(IRREGULAR)
@ -1406,7 +1406,7 @@ EX void resetview() {
} }
void panning(hyperpoint hf, hyperpoint ht) { EX void panning(hyperpoint hf, hyperpoint ht) {
View = View =
rgpushxto0(hf) * rgpushxto0(gpushxto0(hf) * ht) * gpushxto0(hf) * View; rgpushxto0(hf) * rgpushxto0(gpushxto0(hf) * ht) * gpushxto0(hf) * View;
playermoved = false; playermoved = false;

View File

@ -10,7 +10,7 @@ EX int fontscale = 100;
EX int debugflags = DF_INIT | DF_ERROR | DF_WARN | DF_MSG | DF_TIME | DF_LOG; EX int debugflags = DF_INIT | DF_ERROR | DF_WARN | DF_MSG | DF_TIME | DF_LOG;
string s0; EX string s0;
EX bool fixseed = false; EX bool fixseed = false;
EX int startseed = 0; EX int startseed = 0;

View File

@ -1,18 +1,20 @@
// Hyperbolic Rogue -- Orb Strategy Mode // Hyperbolic Rogue -- Orb Strategy Mode
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details // Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
namespace hr { namespace inv { namespace hr {
bool on; EX namespace inv {
array<int, ittypes> usedup;
array<int, ittypes> remaining; EX bool on;
EX array<int, ittypes> usedup;
EX array<int, ittypes> remaining;
array<int, ittypes> extra_orbs; array<int, ittypes> extra_orbs;
int rseed; int rseed;
bool usedForbidden; EX bool usedForbidden;
void init() { EX void init() {
rseed = hrandpos(); rseed = hrandpos();
usedForbidden = false; usedForbidden = false;
for(int i=0; i<ittypes; i++) usedup[i] = 0; for(int i=0; i<ittypes; i++) usedup[i] = 0;
@ -257,7 +259,7 @@ namespace hr { namespace inv {
extra += extraline(tr, itr >= at ? (its(at)+"!") : "10-50"); extra += extraline(tr, itr >= at ? (its(at)+"!") : "10-50");
} }
void compute() { EX void compute() {
extra = ""; extra = "";
orbinfoline = ""; orbinfoline = "";
@ -445,9 +447,9 @@ namespace hr { namespace inv {
return s; return s;
} }
bool activating; EX bool activating;
void show() { EX void show() {
if(remaining[itOrbSword]) items[itOrbSword]++; if(remaining[itOrbSword]) items[itOrbSword]++;
if(remaining[itOrbSword2]) items[itOrbSword2]++; if(remaining[itOrbSword2]) items[itOrbSword2]++;
@ -652,9 +654,9 @@ namespace hr { namespace inv {
} }
#endif #endif
int incheck; EX int incheck;
void check(int delta) { EX void check(int delta) {
incheck += delta; incheck += delta;
for(int i=0; i<ittypes; i++) { for(int i=0; i<ittypes; i++) {
eItem it = eItem(i); eItem it = eItem(i);

View File

@ -1,15 +1,17 @@
namespace hr { namespace irr { namespace hr {
int irrid; EX namespace irr {
EX int irrid;
#if CAP_IRR #if CAP_IRR
ld density = 2; EX ld density = 2;
ld quality = .2; EX ld quality = .2;
int place_attempts = 10; EX int place_attempts = 10;
int rearrange_max_attempts = 50; EX int rearrange_max_attempts = 50;
int rearrange_less = 10; EX int rearrange_less = 10;
int cellcount; EX int cellcount;
struct cellinfo { struct cellinfo {
cell *owner; cell *owner;
@ -100,7 +102,8 @@ int rearrange_index;
bool cell_sorting; bool cell_sorting;
int bitruncations_requested = 1, bitruncations_performed = 0; EX int bitruncations_requested = 1;
EX int bitruncations_performed = 0;
int black_adjacent, white_three; int black_adjacent, white_three;
@ -550,7 +553,7 @@ struct heptinfo {
map<heptagon*, heptinfo> periodmap; map<heptagon*, heptinfo> periodmap;
void link_to_base(heptagon *h, heptspin base) { EX void link_to_base(heptagon *h, heptspin base) {
// printf("linking %p to %p/%d\n", h, base.at, base.spin); // printf("linking %p to %p/%d\n", h, base.at, base.spin);
auto &hi = periodmap[h]; auto &hi = periodmap[h];
hi.base = base; hi.base = base;
@ -562,7 +565,7 @@ void link_to_base(heptagon *h, heptspin base) {
h->c7 = hi.subcells[0]; h->c7 = hi.subcells[0];
} }
void clear_links(heptagon *h) { EX void clear_links(heptagon *h) {
auto& hi = periodmap[h]; auto& hi = periodmap[h];
for(cell *c: hi.subcells) { for(cell *c: hi.subcells) {
for(int i=0; i<c->type; i++) if(c->move(i)) c->move(i)->move(c->c.spin(i)) = NULL; for(int i=0; i<c->type; i++) if(c->move(i)) c->move(i)->move(c->c.spin(i)) = NULL;
@ -573,11 +576,11 @@ void clear_links(heptagon *h) {
periodmap.erase(h); periodmap.erase(h);
} }
void link_start(heptagon *h) { EX void link_start(heptagon *h) {
link_to_base(h, heptspin(cells[0].owner->master, 0)); link_to_base(h, heptspin(cells[0].owner->master, 0));
} }
void link_next(heptagon *parent, int d) { EX void link_next(heptagon *parent, int d) {
if(!periodmap.count(parent)) if(!periodmap.count(parent))
link_to_base(parent, heptspin(cells[0].owner->master, 0)); link_to_base(parent, heptspin(cells[0].owner->master, 0));
// printf("linking next: %p direction %d [s%d]\n", parent, d, parent->c.spin(d)); // printf("linking next: %p direction %d [s%d]\n", parent, d, parent->c.spin(d));
@ -586,13 +589,13 @@ void link_next(heptagon *parent, int d) {
link_to_base(h, hs); link_to_base(h, hs);
} }
void may_link_next(heptagon *parent, int d) { EX void may_link_next(heptagon *parent, int d) {
if(!periodmap.count(parent->move(d))) if(!periodmap.count(parent->move(d)))
link_next(parent, d); link_next(parent, d);
} }
void link_cell(cell *c, int d) { EX void link_cell(cell *c, int d) {
// printf("linking cell: %p direction %d\n", c, d); // printf("linking cell: %p direction %d\n", c, d);
int ci = cellindex[c]; int ci = cellindex[c];
auto& sc = cells[ci]; auto& sc = cells[ci];
@ -775,7 +778,7 @@ void compute_horocycle(heptagon *alt) {
last_on_horocycle[alt] = *(hs[LOOKUP/2].begin()); last_on_horocycle[alt] = *(hs[LOOKUP/2].begin());
} }
int celldist(cell *c, bool alts) { EX int celldist(cell *c, bool alts) {
heptagon *master = c->master; heptagon *master = c->master;
auto &hi = periodmap[master]; auto &hi = periodmap[master];
/* if(alts && master->alt->alt->s != hsOrigin && isize(hi.celldists[alts]) == 0) { /* if(alts && master->alt->alt->s != hsOrigin && isize(hi.celldists[alts]) == 0) {
@ -968,7 +971,7 @@ void show_gridmaker() {
}; };
} }
void visual_creator() { EX void visual_creator() {
stop_game(); stop_game();
orig_geometry = geometry; orig_geometry = geometry;
switch(geometry) { switch(geometry) {
@ -1044,7 +1047,7 @@ int readArgs() {
} }
#endif #endif
unsigned char density_code() { EX unsigned char density_code() {
if(isize(cells) < 128) return isize(cells); if(isize(cells) < 128) return isize(cells);
else { else {
int t = 127, a = isize(cells); int t = 127, a = isize(cells);
@ -1053,19 +1056,19 @@ unsigned char density_code() {
} }
} }
bool pseudohept(cell* c) { EX bool pseudohept(cell* c) {
return cells[cellindex[c]].is_pseudohept; return cells[cellindex[c]].is_pseudohept;
} }
bool ctof(cell* c) { EX bool ctof(cell* c) {
return cells[cellindex[c]].patterndir == -1; return cells[cellindex[c]].patterndir == -1;
} }
bool supports(eGeometry g) { EX bool supports(eGeometry g) {
return among(g, gNormal, gKleinQuartic, gOctagon, gBolza2, gFieldQuotient, gSphere, gSmallSphere, gTinySphere); return among(g, gNormal, gKleinQuartic, gOctagon, gBolza2, gFieldQuotient, gSphere, gSmallSphere, gTinySphere);
} }
array<heptagon*, 3> get_masters(cell *c) { EX array<heptagon*, 3> get_masters(cell *c) {
int d = cells[cellindex[c]].patterndir; int d = cells[cellindex[c]].patterndir;
heptspin s = periodmap[c->master].base; heptspin s = periodmap[c->master].base;
heptspin s0 = heptspin(c->master, 0) + (d - s.spin); heptspin s0 = heptspin(c->master, 0) + (d - s.spin);

View File

@ -12,7 +12,7 @@ eLand lastland;
int lastexplore; int lastexplore;
bool randomPatternsMode = false; EX bool randomPatternsMode = false;
EX int randompattern[landtypes]; EX int randompattern[landtypes];
int genrange_bonus = 0; int genrange_bonus = 0;

View File

@ -5,7 +5,7 @@
namespace hr { namespace hr {
bool nodisplay(eMonster m) { EX bool nodisplay(eMonster m) {
return return
m == moIvyDead || m == moIvyDead ||
m == moDragonTail || m == moDragonTail ||
@ -15,7 +15,7 @@ bool nodisplay(eMonster m) {
} }
// returns: 2 = treasure increaser, 1 = just appears, 0 = does not appear // returns: 2 = treasure increaser, 1 = just appears, 0 = does not appear
int isNative(eLand l, eMonster m) { EX int isNative(eLand l, eMonster m) {
switch(l) { switch(l) {
#define LAND(a,b,c,d,e,f,g) case c: #define LAND(a,b,c,d,e,f,g) case c:
#define NATIVE(x) return x; #define NATIVE(x) return x;
@ -28,13 +28,13 @@ int isNative(eLand l, eMonster m) {
EX eItem treasureType(eLand l) { return linf[l].treasure; } EX eItem treasureType(eLand l) { return linf[l].treasure; }
eItem treasureTypeUnlock(eLand l, eItem u) { EX eItem treasureTypeUnlock(eLand l, eItem u) {
if(u != itOrbLove && l == laPrincessQuest) if(u != itOrbLove && l == laPrincessQuest)
return itPalace; return itPalace;
return treasureType(l); return treasureType(l);
} }
eLand landof(eItem it) { EX eLand landof(eItem it) {
for(int i=0; i<landtypes; i++) if(treasureType(eLand(i)) == it) return eLand(i); for(int i=0; i<landtypes; i++) if(treasureType(eLand(i)) == it) return eLand(i);
return laNone; return laNone;
} }
@ -69,11 +69,11 @@ EX eLand oppositeElement(eLand l, eLand l2) {
// land unlocking // land unlocking
eLand firstland = laIce, specialland = laIce; EX eLand firstland = laIce, specialland = laIce;
int chaosmode = 0; EX int chaosmode = 0;
bool landUnlockedRPM(eLand n) { EX bool landUnlockedRPM(eLand n) {
if(isRandland(n) == 2) return true; if(isRandland(n) == 2) return true;
if(isRandland(n) == 1) if(isRandland(n) == 1)
return (autocheat || cheater || hiitemsMax(treasureType(n)) >= 10); return (autocheat || cheater || hiitemsMax(treasureType(n)) >= 10);
@ -84,7 +84,7 @@ int variant_unlock_value() {
return inv::on ? 75 : 30; return inv::on ? 75 : 30;
} }
bool landUnlocked(eLand l) { EX bool landUnlocked(eLand l) {
if(randomPatternsMode) { if(randomPatternsMode) {
return landUnlockedRPM(l); return landUnlockedRPM(l);
} }
@ -116,7 +116,7 @@ bool landUnlocked(eLand l) {
return false; return false;
} }
void countHyperstoneQuest(int& i1, int& i2) { EX void countHyperstoneQuest(int& i1, int& i2) {
i1 = 0; i2 = 0; i1 = 0; i2 = 0;
generateLandList(isLandIngame); generateLandList(isLandIngame);
for(eLand l: landlist) if(l != laCamelot && l != laPrincessQuest) { for(eLand l: landlist) if(l != laCamelot && l != laPrincessQuest) {
@ -127,7 +127,7 @@ void countHyperstoneQuest(int& i1, int& i2) {
} }
} }
bool hyperstonesUnlocked() { EX bool hyperstonesUnlocked() {
int i1, i2; int i1, i2;
if(tactic::on && isCrossroads(specialland) && !tactic::trailer) return true; if(tactic::on && isCrossroads(specialland) && !tactic::trailer) return true;
countHyperstoneQuest(i1, i2); countHyperstoneQuest(i1, i2);
@ -135,14 +135,14 @@ bool hyperstonesUnlocked() {
} }
// 2 = always available, 1 = highscore required, 0 = never available // 2 = always available, 1 = highscore required, 0 = never available
int isRandland(eLand l) { EX int isRandland(eLand l) {
if(l == laIce || l == laDesert || l == laCaves || l == laWildWest || l == laDocks) if(l == laIce || l == laDesert || l == laCaves || l == laWildWest || l == laDocks)
return 2; return 2;
for(eLand ll: randlands) if(l == ll) return 1; for(eLand ll: randlands) if(l == ll) return 1;
return 0; return 0;
} }
bool incompatible1(eLand l1, eLand l2) { EX bool incompatible1(eLand l1, eLand l2) {
if(isCrossroads(l1) && isCrossroads(l2)) return true; if(isCrossroads(l1) && isCrossroads(l2)) return true;
if(l1 == laJungle && l2 == laMotion) return true; if(l1 == laJungle && l2 == laMotion) return true;
if(l1 == laMirrorOld && l2 == laMotion) return true; if(l1 == laMirrorOld && l2 == laMotion) return true;
@ -165,18 +165,18 @@ bool incompatible1(eLand l1, eLand l2) {
return false; return false;
} }
eLand randomElementalLand() { EX eLand randomElementalLand() {
int i = hrand(4); int i = hrand(4);
eLand t[4] = { laEFire, laEWater, laEAir, laEEarth }; eLand t[4] = { laEFire, laEWater, laEAir, laEEarth };
return t[i]; return t[i];
} }
int elementalKills() { EX int elementalKills() {
return return
kills[moAirElemental] + kills[moWaterElemental] + kills[moEarthElemental] + kills[moFireElemental]; kills[moAirElemental] + kills[moWaterElemental] + kills[moEarthElemental] + kills[moFireElemental];
} }
eLand randomElementalLandWeighted() { EX eLand randomElementalLandWeighted() {
int i = hrand(elementalKills()); int i = hrand(elementalKills());
i -= kills[moAirElemental]; if(i<0) return laEAir; i -= kills[moAirElemental]; if(i<0) return laEAir;
i -= kills[moWaterElemental]; if(i<0) return laEWater; i -= kills[moWaterElemental]; if(i<0) return laEWater;
@ -186,11 +186,11 @@ eLand randomElementalLandWeighted() {
return laElementalWall; return laElementalWall;
} }
bool incompatible(eLand nw, eLand old) { EX bool incompatible(eLand nw, eLand old) {
return (nw == old) || incompatible1(nw, old) || incompatible1(old, nw); return (nw == old) || incompatible1(nw, old) || incompatible1(old, nw);
} }
bool rlyehComplete() { EX bool rlyehComplete() {
if(chaosmode) return items[itStatue] >= 1; if(chaosmode) return items[itStatue] >= 1;
return items[itStatue] >= 10 || items[itGrimoire] >= 10; return items[itStatue] >= 10 || items[itGrimoire] >= 10;
} }
@ -209,7 +209,7 @@ eLand pickLandRPM(eLand old) {
} }
} }
eLand pickluck(eLand l1, eLand l2) { EX eLand pickluck(eLand l1, eLand l2) {
int t1 = items[treasureType(l1)]; int t1 = items[treasureType(l1)];
int t2 = items[treasureType(l2)]; int t2 = items[treasureType(l2)];
if(t1 < t2) return l1; if(t1 < t2) return l1;
@ -229,7 +229,7 @@ eLand pickluck(eLand l1, eLand l2) {
l == laPrairie || l == laHalloween; l == laPrairie || l == laHalloween;
} */ } */
eLand getNewSealand(eLand old) { EX eLand getNewSealand(eLand old) {
while(true) { while(true) {
eLand p = pick(laOcean, pick(laCaribbean, laLivefjord, laWarpSea, laKraken, laDocks)); eLand p = pick(laOcean, pick(laCaribbean, laLivefjord, laWarpSea, laKraken, laDocks));
if(p == laKraken && !landUnlocked(p)) continue; if(p == laKraken && !landUnlocked(p)) continue;
@ -241,7 +241,7 @@ eLand getNewSealand(eLand old) {
} }
} }
bool createOnSea(eLand old) { EX bool createOnSea(eLand old) {
return return
old == laWarpSea || old == laCaribbean || old == laKraken || old == laWarpSea || old == laCaribbean || old == laKraken ||
(old == laLivefjord && hrand(2)) || (old == laLivefjord && hrand(2)) ||
@ -249,9 +249,9 @@ bool createOnSea(eLand old) {
(old == laOcean && (chaosmode ? hrand(2) : !generatingEquidistant)); (old == laOcean && (chaosmode ? hrand(2) : !generatingEquidistant));
} }
hookset<eLand(eLand)> *hooks_nextland; EX hookset<eLand(eLand)> *hooks_nextland;
eLand getNewLand(eLand old) { EX eLand getNewLand(eLand old) {
if(old == laMirror && !chaosmode && hrand(10) >= ((tactic::on || racing::on) ? 0 : markOrb(itOrbLuck) ? 5 : 2)) return laMirrored; if(old == laMirror && !chaosmode && hrand(10) >= ((tactic::on || racing::on) ? 0 : markOrb(itOrbLuck) ? 5 : 2)) return laMirrored;
if(old == laTerracotta && !chaosmode && hrand(5) >= ((tactic::on || racing::on) ? 0 : markOrb(itOrbLuck) ? 2 : 1) && !weirdhyperbolic) return laTerracotta; if(old == laTerracotta && !chaosmode && hrand(5) >= ((tactic::on || racing::on) ? 0 : markOrb(itOrbLuck) ? 2 : 1) && !weirdhyperbolic) return laTerracotta;
@ -557,7 +557,7 @@ template<class T> void generateLandList(T t) {
for(auto l: land_over) if(t(l)) landlist.push_back(l); for(auto l: land_over) if(t(l)) landlist.push_back(l);
} }
eLand getLandForList(cell *c) { EX eLand getLandForList(cell *c) {
eLand l = c->land; eLand l = c->land;
if(isElemental(l)) return laElementalWall; if(isElemental(l)) return laElementalWall;
if(l == laWarpSea) return laWarpCoast; if(l == laWarpSea) return laWarpCoast;
@ -570,7 +570,7 @@ eLand getLandForList(cell *c) {
return l; return l;
} }
bool isLandIngame(eLand l) { EX bool isLandIngame(eLand l) {
if(isElemental(l)) l = laElementalWall; if(isElemental(l)) l = laElementalWall;
if(dual::state == 2 && !dual::check_side(l)) return false; if(dual::state == 2 && !dual::check_side(l)) return false;
if((euclid || sol) && isCyclic(l) && l != specialland) return false; if((euclid || sol) && isCyclic(l) && l != specialland) return false;
@ -653,7 +653,7 @@ int old_daily_id = 1000000;
const int landscapes_when = 1000; const int landscapes_when = 1000;
// check if the given land should appear in lists // check if the given land should appear in lists
land_validity_t& land_validity(eLand l) { EX land_validity_t& land_validity(eLand l) {
using namespace lv; using namespace lv;

View File

@ -12,6 +12,18 @@ EX const char *dnameof(eLand l) { return linf[l].name; }
EX const char *dnameof(eWall w) { return winf[w].name; } EX const char *dnameof(eWall w) { return winf[w].name; }
EX const char *dnameof(eItem i) { return iinf[i].name; } EX const char *dnameof(eItem i) { return iinf[i].name; }
#if HDR
struct stringpar {
string v;
stringpar(string s) : v(s) { }
stringpar(const char* s) : v(s) { }
stringpar(eMonster m) { v= minf[m].name; }
stringpar(eLand l) { v= linf[l].name; }
stringpar(eWall w) { v= winf[w].name; }
stringpar(eItem i) { v= iinf[i].name; }
};
#endif
/* /*
string dnameofEnum(eItem i) { string dnameofEnum(eItem i) {
FILE *f = fopen("classes.cpp", "rt"); FILE *f = fopen("classes.cpp", "rt");

View File

@ -4,6 +4,29 @@
namespace hr { namespace hr {
// orbgen flags // orbgen flags
#if HDR
enum eOrbLandRelation {
olrForbidden, // never appears: forbidden
olrDangerous, // never appears: would be dangerous
olrUseless, // never appears: useless here
olrNoPrizes, // no prizes in this land
olrNoPrizeOrb,// orb not allowed as a prize
olrPrize25, // prize for collecting 25
olrPrize3, // prize for collecting 3
olrNative, // native orb in this land
olrNative1, // native orb in this land (1)
olrGuest, // extra orb in this land
olrPNative, // Land of Power: native
olrPBasic, // Land of Power: basic orbs
olrPPrized, // Land of Power: prized orbs
olrPNever, // Land of Power: foreign orbs
olrHub, // hub lands
olrMonster, // available from a monster
olrAlways, // always available
olrBurns // burns
};
#endif
namespace orbgenflags { namespace orbgenflags {
// generates in the given land from 10 treasures, in the classic mode // generates in the given land from 10 treasures, in the classic mode
static const int LOCAL10 = 1; static const int LOCAL10 = 1;
@ -171,7 +194,7 @@ string olrDescriptions[] = {
"would be destroyed in %the1" "would be destroyed in %the1"
}; };
eOrbLandRelation getOLR(eItem it, eLand l) { EX eOrbLandRelation getOLR(eItem it, eLand l) {
if(l == laPower) { if(l == laPower) {
if(it == itOrbFire) return olrPNative; if(it == itOrbFire) return olrPNative;

View File

@ -1458,7 +1458,7 @@ EX void makelava(cell *c, int i) {
else if(makeflame(c, i, false)) orbused[itOrbLava] = true; else if(makeflame(c, i, false)) orbused[itOrbLava] = true;
} }
void orboflava(int i) { EX void orboflava(int i) {
if(items[itOrbLava]) if(items[itOrbLava])
for(cell *c: dcal) { for(cell *c: dcal) {
if(c->cpdist > 5) break; if(c->cpdist > 5) break;

View File

@ -146,7 +146,7 @@ int land50(cell *c) {
} }
} }
bool polara50(cell *c) { EX bool polara50(cell *c) {
if(sphere || euclid || S7>7 || S6>6) return false; if(sphere || euclid || S7>7 || S6>6) return false;
else if(NONSTDVAR) return polara50(fiftyval(c->master->c7)); else if(NONSTDVAR) return polara50(fiftyval(c->master->c7));
else if(ctof(c)) return polara50(fiftyval(c)); else if(ctof(c)) return polara50(fiftyval(c));
@ -158,7 +158,7 @@ bool polara50(cell *c) {
} }
} }
bool polarb50(cell *c) { EX bool polarb50(cell *c) {
if(euclid) return true; if(euclid) return true;
if(sphere || euclid || S7>7 || S6>6) return true; if(sphere || euclid || S7>7 || S6>6) return true;
else if(NONSTDVAR) return polarb50(fiftyval(c->master->c7)); else if(NONSTDVAR) return polarb50(fiftyval(c->master->c7));
@ -175,7 +175,7 @@ int elhextable[28][3] = {
{0,1,2}, {1,2,9}, {1,9,-1}, {1,8,-1}, {1,-1,-1} {0,1,2}, {1,2,9}, {1,9,-1}, {1,8,-1}, {1,-1,-1}
}; };
int fiftyval049(heptagon *h) { EX int fiftyval049(heptagon *h) {
int i = h->fiftyval / 32; int i = h->fiftyval / 32;
if(i <= 7) return i; if(i <= 7) return i;
if(quotient) return 0; if(quotient) return 0;
@ -191,7 +191,7 @@ int fiftyval049(heptagon *h) {
return allcodes[0] + 7; return allcodes[0] + 7;
} }
int fiftyval049(cell *c) { EX int fiftyval049(cell *c) {
if(euclid) return fiftyval(c) / 32; if(euclid) return fiftyval(c) / 32;
else if(ctof(c)) return fiftyval049(c->master); else if(ctof(c)) return fiftyval049(c->master);
else if(sphere) return 0; else if(sphere) return 0;
@ -228,7 +228,7 @@ int fiftyval049(cell *c) {
} }
} }
int fiftyval200(cell *c) { EX int fiftyval200(cell *c) {
int i = fiftyval049(c); int i = fiftyval049(c);
i *= 4; i *= 4;
if(polara50(c)) i|=1; if(polara50(c)) i|=1;
@ -324,7 +324,7 @@ EX int zebra40(cell *c) {
} }
} }
int zebra3(cell *c) { EX int zebra3(cell *c) {
if(ctof(c)) return (c->master->zebraval/10)/4; if(ctof(c)) return (c->master->zebraval/10)/4;
else if(euclid || sphere || S7>7 || S6>6) return 0; else if(euclid || sphere || S7>7 || S6>6) return 0;
else { else {
@ -1120,7 +1120,7 @@ namespace patterns {
} }
bool geosupport_chessboard() { EX bool geosupport_chessboard() {
return return
#if CAP_ARCM #if CAP_ARCM
(archimedean && PURE) ? arcm::current.support_chessboard() : (archimedean && PURE) ? arcm::current.support_chessboard() :
@ -1130,7 +1130,7 @@ bool geosupport_chessboard() {
(VALENCE % 2 == 0); (VALENCE % 2 == 0);
} }
int geosupport_threecolor() { EX int geosupport_threecolor() {
if(IRREGULAR) return 0; if(IRREGULAR) return 0;
if(penrose || binarytiling) return 0; if(penrose || binarytiling) return 0;
#if CAP_ARCM #if CAP_ARCM
@ -1149,7 +1149,7 @@ int geosupport_threecolor() {
return 0; return 0;
} }
int geosupport_football() { EX int geosupport_football() {
// always works in bitrunc geometries // always works in bitrunc geometries
if(BITRUNCATED) return 2; if(BITRUNCATED) return 2;
if(binarytiling || penrose) return 0; if(binarytiling || penrose) return 0;

View File

@ -1027,13 +1027,13 @@ int nextfiftyval(int par, int gpar, int d) {
exit(1); exit(1);
} }
int land50(int x) { return x&7; } EX int land50(int x) { return x&7; }
bool polara50(int x) { return x&8; } EX bool polara50(int x) { return x&8; }
bool polarb50(int x) { return x&16; } EX bool polarb50(int x) { return x&16; }
int cdist50(int x) { EX int cdist50(int x) {
x /= 32; x /= 32;
if(x == 0) return 0; if(x == 0) return 0;
if(x < 8) return 2; if(x < 8) return 2;

View File

@ -274,7 +274,7 @@ hint hints[] = {
{-1, []() { return false; }, noaction, noaction} {-1, []() { return false; }, noaction, noaction}
}; };
int hinttoshow; EX int hinttoshow;
string contstr() { string contstr() {
return XLAT(canmove ? "continue" : "see how it ended"); return XLAT(canmove ? "continue" : "see how it ended");

View File

@ -31,6 +31,39 @@ GLAPI void APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers)
#endif #endif
#endif #endif
#if HDR
struct renderbuffer {
bool valid;
int x, y;
#if CAP_GL
int tx, ty;
GLuint FramebufferName;
GLuint renderedTexture;
GLuint depth_stencil_rb;
Uint32 *expanded_data;
void use_as_texture();
#endif
#if CAP_SDL
SDL_Surface *srf;
void make_surface();
SDL_Surface *render();
#endif
renderbuffer(int x, int y, bool gl);
~renderbuffer();
void enable();
void clear(color_t col);
};
struct resetbuffer {
GLint drawFboId, readFboId;
SDL_Surface *sreset;
resetbuffer();
void reset();
};
#endif
renderbuffer::renderbuffer(int x, int y, bool gl) : x(x), y(y) { renderbuffer::renderbuffer(int x, int y, bool gl) : x(x), y(y) {
valid = false; valid = false;

View File

@ -167,7 +167,7 @@ void save_memory() {
removed_cells.clear(); removed_cells.clear();
} }
purehookset hooks_removecells; EX purehookset hooks_removecells;
bool is_cell_removed(cell *c) { bool is_cell_removed(cell *c) {
return binary_search(removed_cells.begin(), removed_cells.end(), c); return binary_search(removed_cells.begin(), removed_cells.end(), c);

View File

@ -529,19 +529,19 @@ struct animated_parameter {
vector<animated_parameter> aps; vector<animated_parameter> aps;
void deanimate(ld &x) { EX void deanimate(ld &x) {
for(int i=0; i<isize(aps); i++) for(int i=0; i<isize(aps); i++)
if(aps[i].value == &x) if(aps[i].value == &x)
aps.erase(aps.begin() + (i--)); aps.erase(aps.begin() + (i--));
} }
void get_parameter_animation(ld &x, string &s) { EX void get_parameter_animation(ld &x, string &s) {
for(auto &ap: aps) for(auto &ap: aps)
if(ap.value == &x && ap.last == x) if(ap.value == &x && ap.last == x)
s = ap.formula; s = ap.formula;
} }
void animate_parameter(ld &x, string f, const reaction_t& r) { EX void animate_parameter(ld &x, string f, const reaction_t& r) {
deanimate(x); deanimate(x);
aps.emplace_back(animated_parameter{&x, x, f, r}); aps.emplace_back(animated_parameter{&x, x, f, r});
} }
@ -775,7 +775,7 @@ void animator(string caption, ld& param, char key) {
}); });
} }
ld a, b; EX ld a, b;
void list_animated_parameters() { void list_animated_parameters() {
dialog::addHelp(XLAT( dialog::addHelp(XLAT(

View File

@ -31,7 +31,72 @@ void glError(const char* GLcall, const char* file, const int line) {
#endif #endif
#endif #endif
namespace glhr { EX namespace glhr {
#if HDR
struct glmatrix {
GLfloat a[4][4];
GLfloat* operator[] (int i) { return a[i]; }
const GLfloat* operator[] (int i) const { return a[i]; }
GLfloat* as_array() { return a[0]; }
const GLfloat* as_array() const { return a[0]; }
};
glvertex pointtogl(const hyperpoint& t);
enum class shader_projection { standard, band, halfplane, standardH3, standardR3,
standardS30, standardS31, standardS32, standardS33,
ball, halfplane3, band3, flatten, standardSolv, standardNil,
MAX
};
inline glvertex makevertex(GLfloat x, GLfloat y, GLfloat z) {
#if SHDIM == 3
return make_array(x, y, z);
#else
return make_array<GLfloat>(x, y, z, 1);
#endif
}
struct colored_vertex {
glvertex coords;
glvec4 color;
colored_vertex(GLfloat x, GLfloat y, GLfloat r, GLfloat g, GLfloat b) {
coords[0] = x;
coords[1] = y;
coords[2] = current_display->scrdist;
coords[3] = 1;
color[0] = r;
color[1] = g;
color[2] = b;
color[3] = 1;
}
colored_vertex(hyperpoint h, color_t col) {
coords = pointtogl(h);
for(int i=0; i<4; i++)
color[i] = part(col, 3-i) / 255.0;
}
};
struct textured_vertex {
glvertex coords;
glvec2 texture;
};
struct ct_vertex {
glvertex coords;
glvec4 color;
glvec2 texture;
ct_vertex(const hyperpoint& h, ld x1, ld y1, ld col) {
coords = pointtogl(h);
texture[0] = x1;
texture[1] = y1;
color[0] = color[1] = color[2] = col;
color[3] = 1;
}
};
#endif
#if CAP_SHADER #if CAP_SHADER
bool noshaders = false; bool noshaders = false;
@ -62,7 +127,7 @@ flagtype flags[gmMAX] = { 0, GF_TEXTURE, GF_VARCOLOR, GF_TEXTURE | GF_LIGHTFOG |
eMode mode; eMode mode;
shader_projection current_shader_projection, new_shader_projection; EX shader_projection current_shader_projection, new_shader_projection;
void switch_mode(eMode m, shader_projection sp); void switch_mode(eMode m, shader_projection sp);
@ -99,7 +164,7 @@ glmatrix scale(ld x, ld y, ld z) {
return tmp; return tmp;
} }
glmatrix tmtogl(const transmatrix& T) { EX glmatrix tmtogl(const transmatrix& T) {
glmatrix tmp; glmatrix tmp;
for(int i=0; i<4; i++) for(int i=0; i<4; i++)
for(int j=0; j<4; j++) for(int j=0; j<4; j++)
@ -133,7 +198,7 @@ glmatrix frustum(ld x, ld y, ld vnear = 1e-3, ld vfar = 1e9) {
return as_glmatrix(frustum); return as_glmatrix(frustum);
} }
glmatrix translate(ld x, ld y, ld z) { EX glmatrix translate(ld x, ld y, ld z) {
glmatrix tmp; glmatrix tmp;
for(int i=0; i<4; i++) for(int i=0; i<4; i++)
for(int j=0; j<4; j++) for(int j=0; j<4; j++)
@ -330,7 +395,7 @@ bool operator != (const glmatrix& m1, const glmatrix& m2) {
bool uses_mvp(shader_projection sp) { return among(sp, shader_projection::standard, shader_projection::flatten); } bool uses_mvp(shader_projection sp) { return among(sp, shader_projection::standard, shader_projection::flatten); }
void set_modelview(const glmatrix& modelview) { EX void set_modelview(const glmatrix& modelview) {
#if CAP_NOSHADER #if CAP_NOSHADER
if(noshaders) { if(noshaders) {
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
@ -378,7 +443,7 @@ void id_modelview() {
glUniformMatrix4fv(current->uMVP, 1, 0, projection.as_array()); glUniformMatrix4fv(current->uMVP, 1, 0, projection.as_array());
} }
void color2(color_t color, ld scale) { EX void color2(color_t color, ld scale IS(1)) {
GLfloat cols[4]; GLfloat cols[4];
for(int i=0; i<4; i++) for(int i=0; i<4; i++)
cols[i] = part(color, 3-i) / 255.0 * scale; cols[i] = part(color, 3-i) / 255.0 * scale;
@ -396,9 +461,9 @@ 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); glClearColor(part(color, 3) / 255.0, part(color, 2) / 255.0, part(color, 1) / 255.0, part(color, 0) / 255.0);
} }
void be_nontextured(shader_projection sp) { switch_mode(gmColored, sp); } EX void be_nontextured(shader_projection sp IS(new_shader_projection)) { switch_mode(gmColored, sp); }
void be_textured(shader_projection sp) { switch_mode(gmTextured, sp); } EX void be_textured(shader_projection sp IS(new_shader_projection)) { switch_mode(gmTextured, sp); }
void use_projection(shader_projection sp) { switch_mode(mode, sp); } EX void use_projection(shader_projection sp IS(new_shader_projection)) { switch_mode(mode, sp); }
void switch_mode(eMode m, shader_projection sp) { void switch_mode(eMode m, shader_projection sp) {
if(m == mode && current_shader_projection == sp) return; if(m == mode && current_shader_projection == sp) return;
@ -713,14 +778,14 @@ void init() {
#endif #endif
} }
hyperpoint gltopoint(const glvertex& t) { EX hyperpoint gltopoint(const glvertex& t) {
hyperpoint h; hyperpoint h;
h[0] = t[0]; h[1] = t[1]; h[2] = t[2]; h[0] = t[0]; h[1] = t[1]; h[2] = t[2];
if(SHDIM == 4 && MAXMDIM == 4) h[3] = t[3]; if(SHDIM == 4 && MAXMDIM == 4) h[3] = t[3];
return h; return h;
} }
glvertex pointtogl(const hyperpoint& t) { EX glvertex pointtogl(const hyperpoint& t) {
glvertex h; glvertex h;
h[0] = t[0]; h[1] = t[1]; h[2] = t[2]; h[0] = t[0]; h[1] = t[1]; h[2] = t[2];
if(SHDIM == 4) h[3] = (DIM == 3) ? t[3] : 1; if(SHDIM == 4) h[3] = (DIM == 3) ? t[3] : 1;
@ -780,7 +845,7 @@ void vertices_texture(const vector<glvertex>& v, const vector<glvertex>& t, int
#endif #endif
} }
void prepare(vector<colored_vertex>& v) { EX void prepare(vector<colored_vertex>& v) {
#if CAP_VERTEXBUFFER #if CAP_VERTEXBUFFER
bindbuffer(v); bindbuffer(v);
PTR(glhr::aPosition, SHDIM, coords); PTR(glhr::aPosition, SHDIM, coords);
@ -798,7 +863,7 @@ void prepare(vector<colored_vertex>& v) {
#endif #endif
} }
void prepare(vector<textured_vertex>& v) { EX void prepare(vector<textured_vertex>& v) {
#if CAP_VERTEXBUFFER #if CAP_VERTEXBUFFER
bindbuffer(v); bindbuffer(v);
PTR(glhr::aPosition, SHDIM, coords); PTR(glhr::aPosition, SHDIM, coords);
@ -817,7 +882,7 @@ void prepare(vector<textured_vertex>& v) {
// color2(col); // color2(col);
} }
void prepare(vector<ct_vertex>& v) { EX void prepare(vector<ct_vertex>& v) {
#if CAP_VERTEXBUFFER #if CAP_VERTEXBUFFER
bindbuffer(v); bindbuffer(v);
PTR(glhr::aPosition, SHDIM, coords); PTR(glhr::aPosition, SHDIM, coords);
@ -853,7 +918,7 @@ void store_in_buffer(vector<glvertex>& v) {
#endif #endif
} }
void set_depthtest(bool b) { EX void set_depthtest(bool b) {
if(b != current_depthtest) { if(b != current_depthtest) {
current_depthtest = b; current_depthtest = b;
if(b) glEnable(GL_DEPTH_TEST); if(b) glEnable(GL_DEPTH_TEST);
@ -862,7 +927,7 @@ void set_depthtest(bool b) {
} }
void set_depthwrite(bool b) { EX void set_depthwrite(bool b) {
if(b != current_depthwrite) { // <- this does not work ask intended for some reason... if(b != current_depthwrite) { // <- this does not work ask intended for some reason...
current_depthwrite = b; current_depthwrite = b;
if(b) glDepthMask(GL_TRUE); if(b) glDepthMask(GL_TRUE);
@ -870,14 +935,14 @@ void set_depthwrite(bool b) {
} }
} }
void set_linewidth(ld lw) { EX void set_linewidth(ld lw) {
if(lw != current_linewidth) { if(lw != current_linewidth) {
current_linewidth = lw; current_linewidth = lw;
glLineWidth(lw); glLineWidth(lw);
} }
} }
void switch_to_text(const vector<glvertex>& v, const vector<glvertex>& t) { EX void switch_to_text(const vector<glvertex>& v, const vector<glvertex>& t) {
glhr::be_textured(); glhr::be_textured();
dynamicval<eModel> pm(pmodel, mdUnchanged); dynamicval<eModel> pm(pmodel, mdUnchanged);
if(!svg::in) current_display->set_all(0); if(!svg::in) current_display->set_all(0);

View File

@ -4,22 +4,28 @@
// See http://webmath2.unito.it/paginepersonali/sergio.console/CurveSuperfici/AG15.pdf for a nice reference // See http://webmath2.unito.it/paginepersonali/sergio.console/CurveSuperfici/AG15.pdf for a nice reference
#if CAP_SURFACE #if CAP_SURFACE
namespace hr { namespace surface { namespace hr {
EX namespace surface {
ld sech(ld d) { return 1 / cosh(d); } ld sech(ld d) { return 1 / cosh(d); }
#if HDR
enum eShape { dsNone, dsTractricoid, dsDini, dsKuen, dsHyperlike, dsHyperboloid, dsHemisphere, dsCrystal };
#endif
string shape_name[] = { "hypersian rug", "tractricoid", "Dini's surface", "Kuen surface", "concave barrel", string shape_name[] = { "hypersian rug", "tractricoid", "Dini's surface", "Kuen surface", "concave barrel",
"hyperboloid", "hemisphere", "crystal" }; "hyperboloid", "hemisphere", "crystal" };
eShape sh; EX eShape sh;
hyperpoint unit_vector[3] = {hpxyz(1,0,0), hpxyz(0,1,0), hpxyz(0,0,1)}; hyperpoint unit_vector[3] = {hpxyz(1,0,0), hpxyz(0,1,0), hpxyz(0,0,1)};
ld last_int_of = 0, last_int = 0; ld last_int_of = 0, last_int = 0;
ld dini_b = .15; EX ld dini_b = .15;
ld hyper_b = 1; EX ld hyper_b = 1;
ld f(ld x) { ld f(ld x) {
return sqrt(1 - pow(hyper_b * sinh(x), 2)); return sqrt(1 - pow(hyper_b * sinh(x), 2));
@ -579,7 +585,7 @@ void run_other() {
} }
} }
void run_shape(eShape s) { EX void run_shape(eShape s) {
coverage.clear(); coverage.clear();
need_mouseh = true; need_mouseh = true;
sh = s; sh = s;
@ -663,7 +669,7 @@ void cancel_shape() {
cell *coverage_center; cell *coverage_center;
transmatrix coverage_matrix; transmatrix coverage_matrix;
void show_surfaces() { EX void show_surfaces() {
cmode = sm::SIDE; cmode = sm::SIDE;
gamescreen(0); gamescreen(0);
dialog::init(XLAT("constant curvature surfaces"), iinf[itPalace].color, 150, 0); dialog::init(XLAT("constant curvature surfaces"), iinf[itPalace].color, 150, 0);

View File

@ -8,24 +8,24 @@ namespace hr {
EX bool game_active; EX bool game_active;
bool cblind; EX bool cblind;
bool autocheat; EX bool autocheat;
bool canvas_invisible; EX bool canvas_invisible;
int truelotus; EX int truelotus;
int gamecount; EX int gamecount;
int asteroids_generated, asteroid_orbs_generated; EX int asteroids_generated, asteroid_orbs_generated;
time_t timerstart, savetime; EX time_t timerstart, savetime;
bool timerstopped; EX bool timerstopped;
int savecount; int savecount;
EX bool showoff = false; EX bool showoff = false;
EX bool doCross = false; EX bool doCross = false;
bool gamegen_failure; bool gamegen_failure;
eLand top_land; EX eLand top_land;
bool verless(string v, string cmp) { bool verless(string v, string cmp) {
if(isdigit(v[0]) && isdigit(v[1])) if(isdigit(v[0]) && isdigit(v[1]))
@ -367,7 +367,7 @@ void applyBox(int& t) {
else boxid++; else boxid++;
} }
void applyBoxNum(int& i, string name) { EX void applyBoxNum(int& i, string name IS("")) {
fakebox[boxid] = (name == ""); fakebox[boxid] = (name == "");
boxname[boxid] = name; boxname[boxid] = name;
monsbox[boxid] = false; monsbox[boxid] = false;

View File

@ -2,9 +2,115 @@
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details // Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
#if CAP_TEXTURE #if CAP_TEXTURE
namespace hr { namespace texture { namespace hr {
cpatterntype cgroup; EX namespace texture {
#if HDR
enum eTextureState {
tsOff, tsAdjusting, tsActive
};
struct texture_data {
GLuint textureid;
int twidth;
int tx, ty, origdim;
texture_data() { textureid = 0; twidth = 2048; }
vector<color_t> texture_pixels;
color_t& get_texture_pixel(int x, int y) {
return texture_pixels[(y&(twidth-1))*twidth+(x&(twidth-1))];
}
vector<pair<color_t*, color_t>> undos;
vector<tuple<cell*, hyperpoint, int> > pixels_to_draw;
bool loadTextureGL();
bool whitetexture();
bool readtexture(string tn);
void saveRawTexture(string tn);
void undo();
void undoLock();
void update();
};
struct texture_config {
string texturename;
string configname;
color_t paint_color;
eTextureState tstate;
eTextureState tstate_max;
transmatrix itt;
color_t grid_color;
color_t mesh_color;
color_t master_color;
color_t slave_color;
int color_alpha;
int gsplits;
int recolor(color_t col);
typedef tuple<eGeometry, eVariation, char, int, eModel, ld, ld> texture_parameters;
texture_parameters orig_texture_parameters;
map<int, textureinfo> texture_map, texture_map_orig;
set<cell*> models;
basic_textureinfo tinf3;
bool texture_tuned;
string texture_tuner;
vector<hyperpoint*> tuned_vertices;
bool apply(cell *c, const transmatrix &V, color_t col);
void mark_triangles();
void clear_texture_map();
void perform_mapping();
void mapTextureTriangle(textureinfo &mi, const array<hyperpoint, 3>& v, const array<hyperpoint, 3>& tv, int splits);
void mapTextureTriangle(textureinfo &mi, const array<hyperpoint, 3>& v, const array<hyperpoint, 3>& tv) { mapTextureTriangle(mi, v, tv, gsplits); }
void mapTexture2(textureinfo& mi);
void finish_mapping();
void true_remap();
void remap();
bool correctly_mapped;
hyperpoint texture_coordinates(hyperpoint);
void drawRawTexture();
void saveFullTexture(string tn);
bool save();
bool load();
texture_data data;
texture_config() {
// argh, no member initialization in some of my compilers
texturename = "textures/hyperrogue-texture.png";
configname = "textures/hyperrogue.txc";
itt = Id;
paint_color = 0x000000FF;
grid_color = 0;
mesh_color = 0;
master_color = 0xFFFFFF30;
slave_color = 0xFF000008;
color_alpha = 128;
gsplits = 1;
texture_tuned = false;
}
};
#endif
EX cpatterntype cgroup;
#if CAP_PNG #if CAP_PNG
SDL_Surface *convertSurface(SDL_Surface* s) { SDL_Surface *convertSurface(SDL_Surface* s) {
@ -38,9 +144,9 @@ struct undo {
unsigned last; unsigned last;
}; };
texture_config config; EX texture_config config;
bool saving = false; EX bool saving = false;
template<class T, class U> void scale_colorarray(int origdim, int targetdim, const T& src, const U& dest) { template<class T, class U> void scale_colorarray(int origdim, int targetdim, const T& src, const U& dest) {
int ox = 0, tx = 0, partials[4]; int ox = 0, tx = 0, partials[4];
@ -323,9 +429,9 @@ int texture_config::recolor(color_t col) {
return col; return col;
} }
bool texture_aura; EX bool texture_aura;
bool using_aura() { EX bool using_aura() {
return texture_aura && config.tstate == texture::tsActive; return texture_aura && config.tstate == texture::tsActive;
} }
@ -1081,7 +1187,7 @@ string texturehelp =
"Again, tesselations can have their geometry changed.\n\n"; "Again, tesselations can have their geometry changed.\n\n";
#if CAP_EDIT #if CAP_EDIT
void start_editor() { EX void start_editor() {
addMessage("white"); addMessage("white");
if(config.data.whitetexture() && config.data.loadTextureGL()) { if(config.data.whitetexture() && config.data.loadTextureGL()) {
config.tstate = config.tstate_max = tsActive; config.tstate = config.tstate_max = tsActive;
@ -1093,7 +1199,7 @@ void start_editor() {
} }
#endif #endif
void showMenu() { EX void showMenu() {
cmode = sm::SIDE | sm::MAYDARK | sm::DIALOG_STRICT_X; cmode = sm::SIDE | sm::MAYDARK | sm::DIALOG_STRICT_X;
gamescreen(0); gamescreen(0);
if(config.tstate == tsAdjusting) { if(config.tstate == tsAdjusting) {
@ -1319,7 +1425,7 @@ array<point, 3> ptc(const array<hyperpoint, 3>& h) {
return make_array(ptc(h[0]), ptc(h[1]), ptc(h[2])); return make_array(ptc(h[0]), ptc(h[1]), ptc(h[2]));
} }
ld penwidth = .02; EX ld penwidth = .02;
int texture_distance(pair<int, int> p1, pair<int, int> p2) { int texture_distance(pair<int, int> p1, pair<int, int> p2) {
return max(abs(p1.first-p2.first), abs(p1.second - p2.second)); return max(abs(p1.first-p2.first), abs(p1.second - p2.second));
@ -1420,7 +1526,7 @@ void fillcircle(hyperpoint h, color_t col) {
} }
} }
bool texturesym = false; EX bool texturesym = false;
void actDrawPixel(cell *c, hyperpoint h, color_t col) { void actDrawPixel(cell *c, hyperpoint h, color_t col) {
try { try {
@ -1437,13 +1543,13 @@ void actDrawPixel(cell *c, hyperpoint h, color_t col) {
catch(out_of_range&) {} catch(out_of_range&) {}
} }
void drawPixel(cell *c, hyperpoint h, color_t col) { EX void drawPixel(cell *c, hyperpoint h, color_t col) {
config.data.pixels_to_draw.emplace_back(c, h, col); config.data.pixels_to_draw.emplace_back(c, h, col);
} }
cell *where; EX cell *where;
void drawPixel(hyperpoint h, color_t col) { EX void drawPixel(hyperpoint h, color_t col) {
try { try {
again: again:
transmatrix g0 = gmatrix[where]; transmatrix g0 = gmatrix[where];
@ -1465,7 +1571,7 @@ void drawPixel(hyperpoint h, color_t col) {
catch(out_of_range&) {} catch(out_of_range&) {}
} }
void drawLine(hyperpoint h1, hyperpoint h2, color_t col, int steps) { EX void drawLine(hyperpoint h1, hyperpoint h2, color_t col, int steps IS(10)) {
if(steps > 0 && hdist(h1, h2) > penwidth / 3) { if(steps > 0 && hdist(h1, h2) > penwidth / 3) {
hyperpoint h3 = mid(h1, h2); hyperpoint h3 = mid(h1, h2);
drawLine(h1, h3, col, steps-1); drawLine(h1, h3, col, steps-1);