mirror of
				https://github.com/zenorogue/hyperrogue.git
				synced 2025-10-31 05:52:59 +00:00 
			
		
		
		
	further rearranging
This commit is contained in:
		
							
								
								
									
										66
									
								
								cell.cpp
									
									
									
									
									
								
							
							
						
						
									
										66
									
								
								cell.cpp
									
									
									
									
									
								
							| @@ -38,64 +38,11 @@ void merge(cell *c, int d, cell *c2, int d2, bool mirrored = false) { | ||||
|   tsetspin(c2->spintable, d2, d + (mirrored?8:0)); | ||||
|   } | ||||
|  | ||||
| typedef unsigned short eucoord; | ||||
|  | ||||
| struct cdata { | ||||
|   int val[4]; | ||||
|   int bits; | ||||
|   }; | ||||
|  | ||||
| // list all cells in distance at most maxdist, or until when maxcount cells are reached | ||||
|  | ||||
| struct celllister { | ||||
|   vector<cell*> lst; | ||||
|   vector<int> tmps; | ||||
|   vector<int> dists; | ||||
|    | ||||
|   void add(cell *c, int d) { | ||||
|     if(eq(c->aitmp, sval)) return; | ||||
|     c->aitmp = sval; | ||||
|     tmps.push_back(c->aitmp); | ||||
|     lst.push_back(c); | ||||
|     dists.push_back(d); | ||||
|     } | ||||
|    | ||||
|   ~celllister() { | ||||
|     for(int i=0; i<size(lst); i++) lst[i]->aitmp = tmps[i]; | ||||
|     } | ||||
|    | ||||
|   celllister(cell *orig, int maxdist, int maxcount, cell *breakon) { | ||||
|     lst.clear(); | ||||
|     tmps.clear(); | ||||
|     dists.clear(); | ||||
|     sval++; | ||||
|     add(orig, 0); | ||||
|     cell *last = orig; | ||||
|     for(int i=0; i<size(lst); i++) { | ||||
|       cell *c = lst[i]; | ||||
|       if(maxdist) forCellCM(c2, c) { | ||||
|         add(c2, dists[i]+1); | ||||
|         if(c2 == breakon) return; | ||||
|         } | ||||
|       if(c == last) { | ||||
|         if(size(lst) >= maxcount || dists[i]+1 == maxdist) break; | ||||
|         last = lst[size(lst)-1]; | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|  | ||||
|   void prepare() { | ||||
|     for(int i=0; i<size(lst); i++) lst[i]->aitmp = i; | ||||
|     } | ||||
|    | ||||
|   int getdist(cell *c) { return dists[c->aitmp]; } | ||||
|    | ||||
|   bool listed(cell *c) { | ||||
|     return c->aitmp >= 0 && c->aitmp < size(lst) && lst[c->aitmp] == c; | ||||
|     } | ||||
|    | ||||
|   }; | ||||
|  | ||||
| // -- hrmap --- | ||||
|  | ||||
| struct hrmap { | ||||
| @@ -116,6 +63,7 @@ struct hrmap_alternate : hrmap { | ||||
|   ~hrmap_alternate() { clearfrom(origin); } | ||||
|   }; | ||||
|  | ||||
| hrmap *newAltMap(heptagon *o) { return new hrmap_alternate(o); } | ||||
| // --- hyperbolic geometry --- | ||||
|  | ||||
| struct hrmap_hyperbolic : hrmap { | ||||
| @@ -546,15 +494,6 @@ struct hrmap_quotient : hrmap { | ||||
|  | ||||
| cell *createMov(cell *c, int d); | ||||
|  | ||||
| // similar to heptspin from heptagon.cpp | ||||
| struct cellwalker { | ||||
|   cell *c; | ||||
|   int spin; | ||||
|   bool mirrored; | ||||
|   cellwalker(cell *c, int spin, bool m=false) : c(c), spin(spin), mirrored(m) { } | ||||
|   cellwalker() { mirrored = false; } | ||||
|   }; | ||||
|  | ||||
| void cwspin(cellwalker& cw, int d) { | ||||
|   cw.spin = (cw.spin+(MIRR(cw)?-d:d) + MODFIXER) % cw.c->type; | ||||
|   } | ||||
| @@ -888,9 +827,6 @@ int celldistAlt(cell *c) { | ||||
|   return mi; | ||||
|   } | ||||
|  | ||||
| #define GRAIL_FOUND 0x4000 | ||||
| #define GRAIL_RADIUS_MASK 0x3FFF | ||||
|  | ||||
| int dirfromto(cell *cfrom, cell *cto) { | ||||
|   for(int i=0; i<cfrom->type; i++) if(cfrom->mov[i] == cto) return i; | ||||
|   return -1; | ||||
|   | ||||
| @@ -210,3 +210,6 @@ static const int FORBIDDEN = -1; | ||||
| extern eGeometry geometry; | ||||
|  | ||||
| extern geometryinfo ginf[gGUARD]; | ||||
|  | ||||
| extern monstertype minf[motypes]; | ||||
| extern itemtype iinf[ittypes]; | ||||
|   | ||||
							
								
								
									
										87
									
								
								compileunits.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										87
									
								
								compileunits.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,87 @@ | ||||
| // Usage: | ||||
| // * compile hyper.cpp with CU == 0 | ||||
| // * compile init.cpp with CU == 1 | ||||
| // * link them. | ||||
| // Only the parts defined in #if IN_CU(1) will be included in the second compiling. | ||||
|  | ||||
|  | ||||
| #ifndef CU | ||||
| #define IN_CU(x) 1 | ||||
| #else | ||||
| #define IN_CU(x) (CU == x) | ||||
| #endif | ||||
|  | ||||
| #include "classes.h" | ||||
| #include "hyper.h" | ||||
|  | ||||
| #define CU_INIT IN_CU(0) | ||||
| #define CU_HYPER IN_CU(0) | ||||
|  | ||||
| #if IN_CU(0) | ||||
| #include "classes.cpp" | ||||
| #endif | ||||
|  | ||||
| #if IN_CU(0) | ||||
| #include "util.cpp" | ||||
| #include "hyperpoint.cpp" | ||||
| #include "patterns.cpp" | ||||
| #include "fieldpattern.cpp" | ||||
| #include "heptagon.cpp" | ||||
| #include "language.cpp" | ||||
| #include "cell.cpp" | ||||
| #include "flags.cpp" | ||||
| #include "yendor.cpp" | ||||
| #include "complex.cpp" | ||||
| #include "game.cpp" | ||||
| #include "orbgen.cpp" | ||||
| #include "monstergen.cpp" | ||||
| #include "landlock.cpp" | ||||
| #include "landgen.cpp" | ||||
| #include "orbs.cpp" | ||||
| #if CAP_INV | ||||
| #include "inventory.cpp" | ||||
| #else | ||||
| bool inv::on; | ||||
| #endif | ||||
| #include "system.cpp" | ||||
| #include "debug.cpp" | ||||
| #include "geometry.cpp" | ||||
| #include "polygons.cpp" | ||||
| #include "mapeditor.cpp" | ||||
| #if CAP_MODEL | ||||
| #include "netgen.cpp" | ||||
| #endif | ||||
| #if CAP_TABFONT || CAP_CREATEFONT | ||||
| #include "nofont.cpp" | ||||
| #endif | ||||
| #include "basegraph.cpp" | ||||
| #include "help.cpp" | ||||
| #include "config.cpp" | ||||
| #include "scores.cpp" | ||||
| #include "menus.cpp" | ||||
| #include "quit.cpp" | ||||
| #include "shmup.cpp" | ||||
| #if CAP_ROGUEVIZ | ||||
| #include "rogueviz.cpp" | ||||
| #endif | ||||
| #include "conformal.cpp" | ||||
| #include "rug.cpp" | ||||
| #include "control.cpp" | ||||
| #include "hud.cpp" | ||||
| #include "hypgraph.cpp" | ||||
| #include "graph.cpp" | ||||
| #include "sound.cpp" | ||||
| #include "achievement.cpp" | ||||
| #include "barriers.cpp" | ||||
| #include "bigstuff.cpp" | ||||
| #if CAP_TOUR | ||||
| #include "tour.cpp" | ||||
| #endif | ||||
| #if ISMOBILE==0 | ||||
| #include <unistd.h> | ||||
| #endif | ||||
| #endif | ||||
|  | ||||
| #if IN_CU(1) | ||||
| #endif | ||||
|  | ||||
							
								
								
									
										23
									
								
								complex.cpp
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								complex.cpp
									
									
									
									
									
								
							| @@ -461,14 +461,6 @@ namespace elec { | ||||
|  | ||||
| namespace princess { | ||||
|  | ||||
| #define EPX 39 | ||||
| #define EPY 21 | ||||
|  | ||||
| #define OUT_OF_PRISON 200 | ||||
| #define OUT_OF_PALACE 250 | ||||
| #define PRADIUS0 (141) | ||||
| #define PRADIUS1 (150) | ||||
|  | ||||
|   bool generating = false; | ||||
|   bool challenge = false; | ||||
|   bool saved = false; | ||||
| @@ -484,16 +476,6 @@ namespace princess { | ||||
|    | ||||
|   int reviveAt; | ||||
|    | ||||
|   struct info { | ||||
|     int id;         // id of this info | ||||
|     cell *prison;   // where was the Princess locked | ||||
|     heptagon *alt;  // alt of the prison | ||||
|     int bestdist;   // best dist achieved | ||||
|     int bestnear;   // best dist achieved, by the player | ||||
|     int value;      // number of Rugs at 120 | ||||
|     cell *princess; // where is the Princess currently | ||||
|     }; | ||||
|      | ||||
|   vector<info*> infos; | ||||
|    | ||||
|   void assign(info *i) { | ||||
| @@ -747,11 +729,6 @@ namespace princess { | ||||
|  | ||||
| namespace clearing { | ||||
|  | ||||
|   struct clearingdata { | ||||
|     cell *root; | ||||
|     int dist; | ||||
|     }; | ||||
|    | ||||
|   bool buggyplant = false; | ||||
|    | ||||
|   std::map<heptagon*, clearingdata> bpdata; | ||||
|   | ||||
							
								
								
									
										10
									
								
								debug.cpp
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								debug.cpp
									
									
									
									
									
								
							| @@ -1,16 +1,6 @@ | ||||
| int steplimit = 0; | ||||
| int cstep; | ||||
|  | ||||
| template<class... T> | ||||
| void limitgen(T... args) { | ||||
|   if(steplimit) { | ||||
|     cstep++; | ||||
|     printf("%6d ", cstep); | ||||
|     printf(args...); | ||||
|     if(cstep == steplimit) buggyGeneration = true; | ||||
|     } | ||||
|   } | ||||
|  | ||||
| vector<cell*> buggycells; | ||||
|  | ||||
| cell *pathTowards(cell *pf, cell *pt) { | ||||
|   | ||||
| @@ -711,3 +711,7 @@ fpattern& getcurrfp() { | ||||
| } | ||||
|  | ||||
| #define currfp fieldpattern::getcurrfp() | ||||
|  | ||||
| int currfp_gmul(int a, int b) { return currfp.gmul(a,b); } | ||||
| int currfp_inverses(int i) { return currfp.inverses[i]; } | ||||
| int currfp_distwall(int i) { return currfp.distwall[i]; } | ||||
|   | ||||
							
								
								
									
										60
									
								
								heptagon.cpp
									
									
									
									
									
								
							
							
						
						
									
										60
									
								
								heptagon.cpp
									
									
									
									
									
								
							| @@ -6,55 +6,11 @@ | ||||
|  | ||||
| #define MIRR(x) x.mirrored | ||||
|  | ||||
| int fixrot(int a) { return (a+MODFIXER)% S7; } | ||||
| int fix42(int a) { return (a+MODFIXER)% S42; } | ||||
|  | ||||
| struct heptagon; | ||||
|  | ||||
| struct cell; | ||||
| cell *newCell(int type, heptagon *master); | ||||
|  | ||||
| // spintable functions | ||||
|  | ||||
| void tsetspin(uint32_t& t, int d, int spin) { | ||||
|   t &= ~(15 << (d<<2)); | ||||
|   t |= spin << (d<<2); | ||||
|   } | ||||
|  | ||||
| struct heptagon { | ||||
|   // automaton state | ||||
|   hstate s : 6; | ||||
|   int dm4: 2; | ||||
|   // we are spin[i]-th neighbor of move[i] | ||||
|   uint32_t spintable; | ||||
|   int spin(int d) { return tspin(spintable, d); } | ||||
|   int mirror(int d) { return tmirror(spintable, d); } | ||||
|   void setspin(int d, int sp) { tsetspin(spintable, d, sp); } | ||||
|   // neighbors; move[0] always goes towards origin, | ||||
|   // and then we go clockwise | ||||
|   heptagon* move[MAX_EDGE]; | ||||
|   // distance from the origin | ||||
|   short distance; | ||||
|   // emerald/wineyard generator | ||||
|   short emeraldval; | ||||
|   // fifty generator | ||||
|   short fiftyval; | ||||
|   // zebra generator (1B actually) | ||||
|   short zebraval; | ||||
|   // field id | ||||
|   int fieldval; | ||||
|   // evolution data | ||||
|   short rval0, rval1; | ||||
|   struct cdata *cdata; | ||||
|   // central cell | ||||
|   cell *c7; | ||||
|   // associated generator of alternate structure, for Camelot and horocycles | ||||
|   heptagon *alt; | ||||
|   // functions | ||||
|   heptagon*& modmove(int i) { return move[fixrot(i)]; } | ||||
|   unsigned char gspin(int i) { return spin(fixrot(i)); } | ||||
|   }; | ||||
|  | ||||
| // the automaton is used to generate each heptagon in an unique way | ||||
| // (you can see the tree obtained by changing the conditions in graph.cpp) | ||||
| // from the origin we can go further in any direction, and from other heptagons | ||||
| @@ -92,9 +48,6 @@ hstate transition(hstate s, int dir) { | ||||
|   return hsError; | ||||
|   } | ||||
|  | ||||
| // create h->move[d] if not created yet | ||||
| heptagon *createStep(heptagon *h, int d); | ||||
|  | ||||
| /* | ||||
| int indent = 0; | ||||
|  | ||||
| @@ -196,10 +149,6 @@ void connectHeptagons(heptagon *h1, int d1, heptagon *h2, int d2) { | ||||
|  | ||||
| int recsteps; | ||||
|  | ||||
| void breakpoint() { | ||||
| //  printf("Breakpoint!\n"); | ||||
|   } | ||||
|  | ||||
| void addSpin(heptagon *h, int d, heptagon *from, int rot, int spin) { | ||||
|   rot = fixrot(rot); | ||||
|   createStep(from, rot); | ||||
| @@ -214,8 +163,6 @@ void addSpin(heptagon *h, int d, heptagon *from, int rot, int spin) { | ||||
|  | ||||
| extern int hrand(int); | ||||
|  | ||||
| heptagon *createStep(heptagon *h, int d); | ||||
|  | ||||
| // a structure used to walk on the heptagonal tesselation | ||||
| // (remembers not only the heptagon, but also direction) | ||||
| struct heptspin { | ||||
| @@ -225,13 +172,8 @@ struct heptspin { | ||||
|   heptspin() { mirrored = false; } | ||||
|   }; | ||||
|  | ||||
| int lrecsteps; | ||||
|  | ||||
| heptspin hsstep(const heptspin &hs, int spin) { | ||||
|   recsteps++; | ||||
|   if(recsteps % 5 == 0 && recsteps > lrecsteps) lrecsteps = recsteps, breakpoint(); | ||||
|   createStep(hs.h, hs.spin); | ||||
|   recsteps--; | ||||
|   heptspin res; | ||||
|   res.h = hs.h->move[hs.spin]; | ||||
|   res.mirrored = hs.mirrored ^ hs.h->mirror(hs.spin); | ||||
| @@ -318,4 +260,6 @@ void hsshow(const heptspin& t) { | ||||
|   printf("ORIGIN"); backtrace(t.h); printf(" (spin %d)\n", t.spin); | ||||
|   } | ||||
|  | ||||
| // create h->move[d] if not created yet | ||||
| heptagon *createStep(heptagon *h, int d); | ||||
|  | ||||
| @@ -17,6 +17,8 @@ | ||||
|  | ||||
| #include "init.cpp" | ||||
|  | ||||
| #if CU_HYPER | ||||
|  | ||||
| #if ISLINUX | ||||
| #include <sys/resource.h> | ||||
|  | ||||
| @@ -475,3 +477,4 @@ namespace arg { | ||||
|     } | ||||
|   } | ||||
| #endif | ||||
| #endif | ||||
|   | ||||
							
								
								
									
										309
									
								
								hyper.h
									
									
									
									
									
								
							
							
						
						
									
										309
									
								
								hyper.h
									
									
									
									
									
								
							| @@ -1,3 +1,6 @@ | ||||
| // This is the main header file of HyperRogue. Mostly everything is dumped here. | ||||
| // It is quite chaotic. | ||||
|  | ||||
| // scale the Euclidean | ||||
| #define EUCSCALE 2.3 | ||||
|  | ||||
| @@ -92,14 +95,56 @@ struct gcell { | ||||
|  | ||||
| #define NODIR 8 | ||||
| #define NOBARRIERS 9 | ||||
| #define MODFIXER 23520 | ||||
|  | ||||
| struct heptagon; | ||||
|  | ||||
| struct heptspin; | ||||
|  | ||||
| inline void tsetspin(uint32_t& t, int d, int spin) { t &= ~(15 << (d<<2)); t |= spin << (d<<2); } | ||||
| inline int tspin(uint32_t& t, int d) { return (t >> (d<<2)) & 7; } | ||||
| inline int tmirror(uint32_t& t, int d) { return (t >> ((d<<2)+3)) & 1; } | ||||
|  | ||||
| inline int fixrot(int a) { return (a+MODFIXER)% S7; } | ||||
| inline int fix42(int a) { return (a+MODFIXER)% S42; } | ||||
|  | ||||
| struct cell; | ||||
|  | ||||
| // automaton state | ||||
| enum hstate { hsOrigin, hsA, hsB, hsError, hsA0, hsA1, hsB0, hsB1, hsC }; | ||||
|  | ||||
| struct heptagon { | ||||
|   // automaton state | ||||
|   hstate s : 6; | ||||
|   int dm4: 2; | ||||
|   // we are spin[i]-th neighbor of move[i] | ||||
|   uint32_t spintable; | ||||
|   int spin(int d) { return tspin(spintable, d); } | ||||
|   int mirror(int d) { return tmirror(spintable, d); } | ||||
|   void setspin(int d, int sp) { tsetspin(spintable, d, sp); } | ||||
|   // neighbors; move[0] always goes towards origin, | ||||
|   // and then we go clockwise | ||||
|   heptagon* move[MAX_EDGE]; | ||||
|   // distance from the origin | ||||
|   short distance; | ||||
|   // emerald/wineyard generator | ||||
|   short emeraldval; | ||||
|   // fifty generator | ||||
|   short fiftyval; | ||||
|   // zebra generator (1B actually) | ||||
|   short zebraval; | ||||
|   // field id | ||||
|   int fieldval; | ||||
|   // evolution data | ||||
|   short rval0, rval1; | ||||
|   struct cdata *cdata; | ||||
|   // central cell | ||||
|   cell *c7; | ||||
|   // associated generator of alternate structure, for Camelot and horocycles | ||||
|   heptagon *alt; | ||||
|   // functions | ||||
|   heptagon*& modmove(int i) { return move[fixrot(i)]; } | ||||
|   unsigned char gspin(int i) { return spin(fixrot(i)); } | ||||
|   }; | ||||
|  | ||||
| struct heptspin; | ||||
|  | ||||
| struct cell : gcell { | ||||
|   char type; // 6 for hexagons, 7 for heptagons | ||||
|  | ||||
| @@ -120,12 +165,14 @@ struct cell : gcell { | ||||
|   cell *mov[MAX_EDGE]; // meaning very similar to heptagon::move | ||||
|   }; | ||||
|  | ||||
| struct cellwalker; | ||||
|  | ||||
| // automaton state | ||||
| enum hstate { hsOrigin, hsA, hsB, hsError, hsA0, hsA1, hsB0, hsB1, hsC }; | ||||
|  | ||||
| #define MODFIXER 23520 | ||||
| // similar to heptspin from heptagon.cpp | ||||
| struct cellwalker { | ||||
|   cell *c; | ||||
|   int spin; | ||||
|   bool mirrored; | ||||
|   cellwalker(cell *c, int spin, bool m=false) : c(c), spin(spin), mirrored(m) { } | ||||
|   cellwalker() { mirrored = false; } | ||||
|   }; | ||||
|  | ||||
| #define BUGCOLORS 3 | ||||
|  | ||||
| @@ -1726,7 +1773,18 @@ extern bool landUnlocked(eLand l); | ||||
| extern void describeCell(cell*); | ||||
| extern bool rlyehComplete(); | ||||
|  | ||||
| template<class... T> void limitgen(T... args); | ||||
| 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(); | ||||
| @@ -1807,3 +1865,232 @@ struct polytodraw { | ||||
| #endif | ||||
|   }; | ||||
|  | ||||
| extern bool purehepta; | ||||
| extern int emeraldtable[100][7]; | ||||
|  | ||||
| extern void cwspin(cellwalker& cw, int d); | ||||
| extern cell *cwpeek(cellwalker cw, int dir); | ||||
| extern void cwstep(cellwalker& cw); | ||||
| extern void cwrevstep(cellwalker& cw); | ||||
| extern void cwrev(cellwalker& cw); | ||||
|  | ||||
| const eLand NOWALLSEP = laNone; | ||||
| const eLand NOWALLSEP_USED = laWhirlpool; | ||||
|  | ||||
| bool hasbardir(cell *c); | ||||
|  | ||||
| bool buildBarrierNowall(cell *c, eLand l2, bool force = false); | ||||
| 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 moreBigStuff(cell *c); | ||||
| void setLandEuclid(cell *c); | ||||
| bool checkInTree(cell *c, int maxv); | ||||
| cell *findcompass(cell *c); | ||||
| int edgeDepth(cell *c); | ||||
| int compassDist(cell *c); | ||||
|  | ||||
| #define HAUNTED_RADIUS getDistLimit() | ||||
| #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 getHemisphere(cell *c, int which); | ||||
|  | ||||
| #define euclid (ginf[geometry].cclass == 1) | ||||
| #define sphere (ginf[geometry].cclass == 2) | ||||
| #define elliptic (ginf[geometry].quotientstyle & 4) | ||||
| #define quotient (ginf[geometry].quotientstyle & 3) | ||||
| #define torus (ginf[geometry].quotientstyle & 8) | ||||
| #define doall (ginf[geometry].quotientstyle) | ||||
| #define smallbounded (sphere || quotient == 1 || torus) | ||||
|  | ||||
| namespace tactic { | ||||
|   extern bool on; | ||||
|   extern bool trailer; | ||||
|   extern eLand lasttactic; | ||||
|   } | ||||
|  | ||||
| namespace yendor { | ||||
|   extern bool on; | ||||
|   extern bool generating; | ||||
|   extern eLand nexttostart; | ||||
|    | ||||
|   #define YF_DEAD 1 | ||||
|   #define YF_WALLS 2 | ||||
|   #define YF_END 4 | ||||
|   #define YF_DEAD5 8 | ||||
|  | ||||
|   #define YF_NEAR_IVY   16 | ||||
|   #define YF_NEAR_ELEM  32 | ||||
|   #define YF_NEAR_OVER  64 | ||||
|   #define YF_NEAR_RED   128 | ||||
|   #define YF_REPEAT     512 | ||||
|   #define YF_NEAR_TENT  1024 | ||||
|  | ||||
|   #define YF_START_AL   2048 | ||||
|   #define YF_START_CR   4096 | ||||
|   #define YF_CHAOS      8192 | ||||
|   #define YF_RECALL     16384 | ||||
|   #define YF_NEAR_FJORD 32768 | ||||
|    | ||||
|   #define YF_START_ANY  (YF_START_AL|YF_START_CR)   | ||||
|  | ||||
|   struct yendorlevel { | ||||
|     eLand l; | ||||
|     int flags; | ||||
|     }; | ||||
|    | ||||
|   yendorlevel& clev(); | ||||
|   } | ||||
|  | ||||
| namespace clearing { | ||||
|  | ||||
|   struct clearingdata { | ||||
|     cell *root; | ||||
|     int dist; | ||||
|     }; | ||||
|    | ||||
|   extern bool buggyplant; | ||||
|    | ||||
|   extern std::map<heptagon*, clearingdata> bpdata; | ||||
|   } | ||||
|  | ||||
| namespace peace { | ||||
|   extern bool on; | ||||
|   } | ||||
|  | ||||
| namespace princess { | ||||
| #define EPX 39 | ||||
| #define EPY 21 | ||||
|  | ||||
| #define OUT_OF_PRISON 200 | ||||
| #define OUT_OF_PALACE 250 | ||||
| #define PRADIUS0 (141) | ||||
| #define PRADIUS1 (150) | ||||
|  | ||||
|   extern bool generating; | ||||
|   extern bool gotoPrincess; | ||||
|   extern bool forceMouse; | ||||
|   extern bool challenge; | ||||
|  | ||||
|   struct info { | ||||
|     int id;         // id of this info | ||||
|     cell *prison;   // where was the Princess locked | ||||
|     heptagon *alt;  // alt of the prison | ||||
|     int bestdist;   // best dist achieved | ||||
|     int bestnear;   // best dist achieved, by the player | ||||
|     int value;      // number of Rugs at 120 | ||||
|     cell *princess; // where is the Princess currently | ||||
|     }; | ||||
|      | ||||
|   int newInfo(cell *c); | ||||
|   } | ||||
|  | ||||
| #define GRAIL_FOUND 0x4000 | ||||
| #define GRAIL_RADIUS_MASK 0x3FFF | ||||
|  | ||||
| int eudist(short sx, short sy); | ||||
|  | ||||
| heptagon *createStep(heptagon *h, int d); | ||||
|  | ||||
| cell *createMovR(cell *c, int d); | ||||
|  | ||||
| bool ishept(cell *c); | ||||
| int cdist50(cell *c); | ||||
| int polarb50(cell *c); | ||||
|  | ||||
| bool isGravityLand(eLand l); | ||||
| bool isWarped(eLand l); | ||||
|  | ||||
| struct hrmap; | ||||
| extern hrmap *currentmap; | ||||
| extern vector<hrmap*> allmaps; | ||||
|  | ||||
| // list all cells in distance at most maxdist, or until when maxcount cells are reached | ||||
|  | ||||
| struct celllister { | ||||
|   vector<cell*> lst; | ||||
|   vector<int> tmps; | ||||
|   vector<int> dists; | ||||
|    | ||||
|   void add(cell *c, int d) { | ||||
|     if(eq(c->aitmp, sval)) return; | ||||
|     c->aitmp = sval; | ||||
|     tmps.push_back(c->aitmp); | ||||
|     lst.push_back(c); | ||||
|     dists.push_back(d); | ||||
|     } | ||||
|    | ||||
|   ~celllister() { | ||||
|     for(int i=0; i<size(lst); i++) lst[i]->aitmp = tmps[i]; | ||||
|     } | ||||
|    | ||||
|   celllister(cell *orig, int maxdist, int maxcount, cell *breakon) { | ||||
|     lst.clear(); | ||||
|     tmps.clear(); | ||||
|     dists.clear(); | ||||
|     sval++; | ||||
|     add(orig, 0); | ||||
|     cell *last = orig; | ||||
|     for(int i=0; i<size(lst); i++) { | ||||
|       cell *c = lst[i]; | ||||
|       if(maxdist) forCellCM(c2, c) { | ||||
|         add(c2, dists[i]+1); | ||||
|         if(c2 == breakon) return; | ||||
|         } | ||||
|       if(c == last) { | ||||
|         if(size(lst) >= maxcount || dists[i]+1 == maxdist) break; | ||||
|         last = lst[size(lst)-1]; | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|  | ||||
|   void prepare() { | ||||
|     for(int i=0; i<size(lst); i++) lst[i]->aitmp = i; | ||||
|     } | ||||
|    | ||||
|   int getdist(cell *c) { return dists[c->aitmp]; } | ||||
|    | ||||
|   bool listed(cell *c) { | ||||
|     return c->aitmp >= 0 && c->aitmp < size(lst) && lst[c->aitmp] == c; | ||||
|     } | ||||
|    | ||||
|   }; | ||||
|  | ||||
| typedef unsigned short eucoord; | ||||
| void decodeMaster(heptagon *h, eucoord& x, eucoord& y); | ||||
|  | ||||
| hrmap *newAltMap(heptagon *o); | ||||
|  | ||||
| #define currfp fieldpattern::getcurrfp() | ||||
| namespace fieldpattern { | ||||
|   struct fpattern& getcurrfp(); | ||||
|   } | ||||
|  | ||||
| int currfp_gmul(int a, int b); | ||||
| int currfp_inverses(int i); | ||||
| int currfp_distwall(int i); | ||||
|  | ||||
| const char *dnameof(eMonster m); | ||||
| const char *dnameof(eLand l); | ||||
| const char *dnameof(eWall w); | ||||
| const char *dnameof(eItem i); | ||||
|   | ||||
| @@ -4,14 +4,6 @@ | ||||
| eGeometry geometry, targetgeometry = gEuclid; | ||||
| extern bool targettrunc; | ||||
|  | ||||
| #define euclid (ginf[geometry].cclass == 1) | ||||
| #define sphere (ginf[geometry].cclass == 2) | ||||
| #define elliptic (ginf[geometry].quotientstyle & 4) | ||||
| #define quotient (ginf[geometry].quotientstyle & 3) | ||||
| #define torus (ginf[geometry].quotientstyle & 8) | ||||
| #define doall (ginf[geometry].quotientstyle) | ||||
| #define smallbounded (sphere || quotient == 1 || torus) | ||||
|  | ||||
| // for the pure heptagonal grid | ||||
| bool purehepta = false; | ||||
|  | ||||
|   | ||||
							
								
								
									
										69
									
								
								init.cpp
									
									
									
									
									
								
							
							
						
						
									
										69
									
								
								init.cpp
									
									
									
									
									
								
							| @@ -339,12 +339,9 @@ void addMessage(string s, char spamtype = 0); | ||||
| #define MAX_S3 4 | ||||
| #define MAX_S84 240 | ||||
|  | ||||
| #ifdef ONE_CU | ||||
| #include "classes.h" | ||||
| #include "hyper.h" | ||||
|  | ||||
| #else | ||||
| #include "compileunits.h" | ||||
|  | ||||
| #if CU_INIT | ||||
| int fontscale = 100; | ||||
|  | ||||
| #if ISANDROID | ||||
| @@ -365,68 +362,6 @@ const char *loadlevel = NULL; | ||||
|  | ||||
| string s0; | ||||
|  | ||||
| #include "classes.cpp" | ||||
| #include "hyper.h" | ||||
|  | ||||
| #include "util.cpp" | ||||
| #include "hyperpoint.cpp" | ||||
| #include "patterns.cpp" | ||||
| #include "fieldpattern.cpp" | ||||
| #include "heptagon.cpp" | ||||
| #include "language.cpp" | ||||
| #include "cell.cpp" | ||||
| #include "flags.cpp" | ||||
| #include "yendor.cpp" | ||||
| #include "complex.cpp" | ||||
| #include "game.cpp" | ||||
| #include "orbgen.cpp" | ||||
| #include "monstergen.cpp" | ||||
| #include "barriers.cpp" | ||||
| #include "bigstuff.cpp" | ||||
| #include "landlock.cpp" | ||||
| #include "landgen.cpp" | ||||
| #include "orbs.cpp" | ||||
| #if CAP_INV | ||||
| #include "inventory.cpp" | ||||
| #else | ||||
| bool inv::on; | ||||
| #endif | ||||
| #include "system.cpp" | ||||
| #include "debug.cpp" | ||||
| #include "geometry.cpp" | ||||
| #include "polygons.cpp" | ||||
| #include "mapeditor.cpp" | ||||
| #if CAP_MODEL | ||||
| #include "netgen.cpp" | ||||
| #endif | ||||
| #if CAP_TABFONT || CAP_CREATEFONT | ||||
| #include "nofont.cpp" | ||||
| #endif | ||||
| #include "basegraph.cpp" | ||||
| #include "help.cpp" | ||||
| #include "config.cpp" | ||||
| #include "scores.cpp" | ||||
| #include "menus.cpp" | ||||
| #include "quit.cpp" | ||||
| #include "shmup.cpp" | ||||
| #if CAP_ROGUEVIZ | ||||
| #include "rogueviz.cpp" | ||||
| #endif | ||||
| #include "conformal.cpp" | ||||
| #include "rug.cpp" | ||||
| #include "control.cpp" | ||||
| #include "hud.cpp" | ||||
| #include "hypgraph.cpp" | ||||
| #include "graph.cpp" | ||||
| #include "sound.cpp" | ||||
| #include "achievement.cpp" | ||||
| #if CAP_TOUR | ||||
| #include "tour.cpp" | ||||
| #endif | ||||
| #if ISMOBILE==0 | ||||
| #include <unistd.h> | ||||
| #endif | ||||
|  | ||||
| bool fixseed = false; | ||||
| int startseed = 0; | ||||
|  | ||||
|   | ||||
							
								
								
									
										25
									
								
								yendor.cpp
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								yendor.cpp
									
									
									
									
									
								
							| @@ -42,11 +42,6 @@ namespace yendor { | ||||
|   bool won = false; | ||||
|   bool easy = false; | ||||
|    | ||||
|   struct yendorlevel { | ||||
|     eLand l; | ||||
|     int flags; | ||||
|     }; | ||||
|    | ||||
|   int challenge; // id of the challenge | ||||
|   int lastchallenge; | ||||
|    | ||||
| @@ -54,26 +49,6 @@ namespace yendor { | ||||
|    | ||||
|   map<modecode_t, array<int, YENDORLEVELS>> bestscore; | ||||
|  | ||||
|   #define YF_DEAD 1 | ||||
|   #define YF_WALLS 2 | ||||
|   #define YF_END 4 | ||||
|   #define YF_DEAD5 8 | ||||
|  | ||||
|   #define YF_NEAR_IVY   16 | ||||
|   #define YF_NEAR_ELEM  32 | ||||
|   #define YF_NEAR_OVER  64 | ||||
|   #define YF_NEAR_RED   128 | ||||
|   #define YF_REPEAT     512 | ||||
|   #define YF_NEAR_TENT  1024 | ||||
|  | ||||
|   #define YF_START_AL   2048 | ||||
|   #define YF_START_CR   4096 | ||||
|   #define YF_CHAOS      8192 | ||||
|   #define YF_RECALL     16384 | ||||
|   #define YF_NEAR_FJORD 32768 | ||||
|    | ||||
|   #define YF_START_ANY  (YF_START_AL|YF_START_CR) | ||||
|    | ||||
|   eLand nexttostart; | ||||
|  | ||||
| #define LAND_YENDOR_CHAOS 41 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Zeno Rogue
					Zeno Rogue