mirror of
				https://github.com/zenorogue/hyperrogue.git
				synced 2025-10-31 05:52:59 +00:00 
			
		
		
		
	further cleanup
This commit is contained in:
		| @@ -73,6 +73,13 @@ EX const char* leadernames[NUMLEADER] = { | |||||||
| #define LB_HALLOWEEN  63 | #define LB_HALLOWEEN  63 | ||||||
| #define LB_RACING 81 | #define LB_RACING 81 | ||||||
|  |  | ||||||
|  | EX bool haveLeaderboard(int id); | ||||||
|  | EX int get_currentscore(int id); | ||||||
|  | EX void set_priority_board(int id); | ||||||
|  | EX int get_sync_status(); | ||||||
|  | EX bool score_loaded(int id); | ||||||
|  | EX int score_default(int id); | ||||||
|  |  | ||||||
| EX void upload_score(int id, int v); | EX void upload_score(int id, int v); | ||||||
|  |  | ||||||
| string achievementMessage[3]; | string achievementMessage[3]; | ||||||
|   | |||||||
| @@ -854,7 +854,7 @@ void gdpush_utf8(const string& s) { | |||||||
|   graphdata[g] = q; |   graphdata[g] = q; | ||||||
|   } |   } | ||||||
|  |  | ||||||
| bool displayfr(int x, int y, int b, int size, const string &s, color_t color, int align) { | EX bool displayfr(int x, int y, int b, int size, const string &s, color_t color, int align) { | ||||||
|   gdpush(2); gdpush(x); gdpush(y); gdpush(align); |   gdpush(2); gdpush(x); gdpush(y); gdpush(align); | ||||||
|   gdpush(color); gdpush(size); gdpush(b); |   gdpush(color); gdpush(size); gdpush(b); | ||||||
|   gdpush_utf8(s); |   gdpush_utf8(s); | ||||||
| @@ -866,15 +866,16 @@ bool displayfr(int x, int y, int b, int size, const string &s, color_t color, in | |||||||
|     my >= -size*3/4 && my <= +size*3/4; |     my >= -size*3/4 && my <= +size*3/4; | ||||||
|   } |   } | ||||||
|  |  | ||||||
| bool displaystr(int x, int y, int shift, int size, const string &s, color_t color, int align) { | EX bool displaystr(int x, int y, int shift, int size, const string &s, color_t color, int align) { | ||||||
|   return displayfr(x,y,0,size,s,color,align); |   return displayfr(x,y,0,size,s,color,align); | ||||||
|   } |   } | ||||||
|  |  | ||||||
| bool displaystr(int x, int y, int shift, int size, char const *s, color_t color, int align) { | EX bool displaystr(int x, int y, int shift, int size, char const *s, color_t color, int align) { | ||||||
|   return displayfr(x,y,0,size,s,color,align); |   return displayfr(x,y,0,size,s,color,align); | ||||||
|   } |   } | ||||||
|  |  | ||||||
| #else | #endif | ||||||
|  | #if !CAP_XGD | ||||||
| EX bool displaystr(int x, int y, int shift, int size, const char *str, color_t color, int align) { | EX bool displaystr(int x, int y, int shift, int size, const char *str, color_t color, int align) { | ||||||
|  |  | ||||||
|   if(strlen(str) == 0) return false; |   if(strlen(str) == 0) return false; | ||||||
| @@ -1198,8 +1199,12 @@ EX void displayButton(int x, int y, const string& name, int key, int align, int | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
| char mousekey = 'n'; | #if HDR | ||||||
| char newmousekey; | #define SETMOUSEKEY 5000 | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | EX char mousekey = 'n'; | ||||||
|  | EX char newmousekey; | ||||||
|  |  | ||||||
| EX void displaymm(char c, int x, int y, int rad, int size, const string& title, int align) { | EX void displaymm(char c, int x, int y, int rad, int size, const string& title, int align) { | ||||||
|   if(displayfr(x, y, rad, size, title, c == mousekey ? 0xFF8000 : 0xC0C0C0, align)) { |   if(displayfr(x, y, rad, size, title, c == mousekey ? 0xFF8000 : 0xC0C0C0, align)) { | ||||||
|   | |||||||
| @@ -99,6 +99,12 @@ static const flagtype IF_RANGED = Flag(4); | |||||||
| static const flagtype IF_SHMUPLIFE = Flag(5); | static const flagtype IF_SHMUPLIFE = Flag(5); | ||||||
| static const flagtype IF_REVIVAL = Flag(6); | static const flagtype IF_REVIVAL = Flag(6); | ||||||
|  |  | ||||||
|  | // 0 = basic treasure, 1 = other item, 2 = power orb, 3 = not an item | ||||||
|  | #define IC_TREASURE 0 | ||||||
|  | #define IC_OTHER 1 | ||||||
|  | #define IC_ORB 2 | ||||||
|  | #define IC_NAI 3 | ||||||
|  |  | ||||||
| struct itemtype { | struct itemtype { | ||||||
|   char  glyph; |   char  glyph; | ||||||
|   color_t color; |   color_t color; | ||||||
|   | |||||||
							
								
								
									
										50
									
								
								complex.cpp
									
									
									
									
									
								
							
							
						
						
									
										50
									
								
								complex.cpp
									
									
									
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @@ -21,6 +21,8 @@ EX const char* COLORBAR = "###"; | |||||||
| EX namespace dialog { | EX namespace dialog { | ||||||
|  |  | ||||||
| #if HDR | #if HDR | ||||||
|  |   #define IFM(x) (mousing?"":x) | ||||||
|  |  | ||||||
|   static const int DONT_SHOW = 16; |   static const int DONT_SHOW = 16; | ||||||
|  |  | ||||||
|   enum tDialogItem {diTitle, diItem, diBreak, diHelp, diInfo, diIntSlider, diSlider, diBigItem, diKeyboard}; |   enum tDialogItem {diTitle, diItem, diBreak, diHelp, diInfo, diIntSlider, diSlider, diBigItem, diKeyboard}; | ||||||
|   | |||||||
							
								
								
									
										47
									
								
								euclid.cpp
									
									
									
									
									
								
							
							
						
						
									
										47
									
								
								euclid.cpp
									
									
									
									
									
								
							| @@ -23,7 +23,7 @@ EX pair<int, int> vec_to_pair(int vec) { | |||||||
|   return {x, y}; |   return {x, y}; | ||||||
|   } |   } | ||||||
|  |  | ||||||
| namespace torusconfig { | EX namespace torusconfig { | ||||||
|   // the configuration of the torus topology. |   // the configuration of the torus topology. | ||||||
|   // torus cells are indexed [0..qty), |   // torus cells are indexed [0..qty), | ||||||
|   // where the cell to the right from i is indexed i+dx, |   // where the cell to the right from i is indexed i+dx, | ||||||
| @@ -37,13 +37,45 @@ namespace torusconfig { | |||||||
|   int def_qty = 127*3, dx = 1, def_dy = -11*2; |   int def_qty = 127*3, dx = 1, def_dy = -11*2; | ||||||
|   int qty = def_qty, dy = def_dy; |   int qty = def_qty, dy = def_dy; | ||||||
|    |    | ||||||
|   int sdx = 12, sdy = 12; |   EX int sdx = 12; | ||||||
|  |   EX int sdy = 12; | ||||||
|  |    | ||||||
|  |   #if HDR | ||||||
|  |   enum eTorusMode : char {  | ||||||
|  |     tmSingleHex,  | ||||||
|  |     tmSingle,  | ||||||
|  |     tmSlantedHex,  | ||||||
|  |     tmStraight,  | ||||||
|  |     tmStraightHex, | ||||||
|  |     tmKlein, | ||||||
|  |     tmKleinHex, | ||||||
|  |     tmCylinder, | ||||||
|  |     tmCylinderHex, | ||||||
|  |     tmMobius, | ||||||
|  |     tmMobiusHex, | ||||||
|  |     }; | ||||||
|  |  | ||||||
|  |   struct torusmode_info { | ||||||
|  |     string name; | ||||||
|  |     flagtype flags; | ||||||
|  |     }; | ||||||
|  |  | ||||||
|  |   enum : flagtype { | ||||||
|  |     TF_SINGLE = 1, | ||||||
|  |     TF_SIMPLE = 2, | ||||||
|  |     TF_WEIRD  = 4, | ||||||
|  |     TF_HEX    = 16, | ||||||
|  |     TF_SQUARE = 32, | ||||||
|  |     TF_CYL    = 64, | ||||||
|  |     TF_KLEIN = 256, | ||||||
|  |     }; | ||||||
|  |   #endif | ||||||
|  |  | ||||||
|   // new values to change |   // new values to change | ||||||
|   int newqty, newdy, newsdx, newsdy; |   int newqty, newdy, newsdx, newsdy; | ||||||
|   int torus_cx, torus_cy; |   int torus_cx, torus_cy; | ||||||
|    |    | ||||||
|   vector<torusmode_info> tmodes = { |   EX vector<torusmode_info> tmodes = { | ||||||
|     {"single row (hex)", TF_SINGLE | TF_HEX}, |     {"single row (hex)", TF_SINGLE | TF_HEX}, | ||||||
|     {"single row (squares)", TF_SINGLE | TF_SQUARE}, |     {"single row (squares)", TF_SINGLE | TF_SQUARE}, | ||||||
|     {"parallelogram (hex)", TF_SIMPLE | TF_HEX}, |     {"parallelogram (hex)", TF_SIMPLE | TF_HEX}, | ||||||
| @@ -57,8 +89,9 @@ namespace torusconfig { | |||||||
|     {"Möbius band (hex)", TF_SIMPLE | TF_CYL | TF_HEX | TF_KLEIN}, |     {"Möbius band (hex)", TF_SIMPLE | TF_CYL | TF_HEX | TF_KLEIN}, | ||||||
|     }; |     }; | ||||||
|    |    | ||||||
|   eTorusMode torus_mode, newmode; |   EX eTorusMode torus_mode; | ||||||
|   flagtype tmflags() { return tmodes[torus_mode].flags; } |   eTorusMode newmode; | ||||||
|  |   EX flagtype tmflags() { return tmodes[torus_mode].flags; } | ||||||
|    |    | ||||||
|   int getqty() { |   int getqty() { | ||||||
|     if(tmflags() & TF_SINGLE) |     if(tmflags() & TF_SINGLE) | ||||||
| @@ -139,7 +172,7 @@ namespace torusconfig { | |||||||
|  |  | ||||||
|   int tester = addHook(hooks_tests, 0, torus_test); |   int tester = addHook(hooks_tests, 0, torus_test); | ||||||
|    |    | ||||||
|   void activate() { |   EX void activate() { | ||||||
|     auto& gi(ginf[gTorus]); |     auto& gi(ginf[gTorus]); | ||||||
|  |  | ||||||
|     if(tmflags() & TF_HEX) |     if(tmflags() & TF_HEX) | ||||||
| @@ -262,7 +295,7 @@ namespace torusconfig { | |||||||
|      |      | ||||||
|     return dist; |     return dist; | ||||||
|     } |     } | ||||||
|   } |   EX } | ||||||
|  |  | ||||||
| int euclid_getvec(int dx, int dy) { | int euclid_getvec(int dx, int dy) { | ||||||
|   if(euwrap) return torusconfig::getvec(dx, dy); |   if(euwrap) return torusconfig::getvec(dx, dy); | ||||||
|   | |||||||
| @@ -7,6 +7,8 @@ namespace hr { | |||||||
| EX namespace fieldpattern { | EX namespace fieldpattern { | ||||||
|  |  | ||||||
| #if HDR | #if HDR | ||||||
|  | #define currfp fieldpattern::getcurrfp() | ||||||
|  |  | ||||||
| struct primeinfo { | struct primeinfo { | ||||||
|   int p; |   int p; | ||||||
|   int cells; |   int cells; | ||||||
| @@ -743,7 +745,7 @@ void info() { | |||||||
| fpattern current_quotient_field(0), fp_invalid(0); | fpattern current_quotient_field(0), fp_invalid(0); | ||||||
| bool quotient_field_changed; | bool quotient_field_changed; | ||||||
|  |  | ||||||
| fpattern& getcurrfp() { | EX struct fpattern& getcurrfp() { | ||||||
|   if(geometry == gFieldQuotient && quotient_field_changed) |   if(geometry == gFieldQuotient && quotient_field_changed) | ||||||
|     return current_quotient_field;   |     return current_quotient_field;   | ||||||
|   if(WDIM == 3) { |   if(WDIM == 3) { | ||||||
| @@ -831,13 +833,13 @@ EX void enableFieldChange() { | |||||||
|  |  | ||||||
| #define currfp fieldpattern::getcurrfp() | #define currfp fieldpattern::getcurrfp() | ||||||
|  |  | ||||||
| int currfp_gmul(int a, int b) { return currfp.gmul(a,b); } | EX int currfp_gmul(int a, int b) { return currfp.gmul(a,b); } | ||||||
| int currfp_inverses(int i) { return currfp.inverses[i]; } | EX int currfp_inverses(int i) { return currfp.inverses[i]; } | ||||||
| int currfp_distwall(int i) { return currfp.distwall[i]; } | EX int currfp_distwall(int i) { return currfp.distwall[i]; } | ||||||
| int currfp_n() { return isize(currfp.matrices); } | EX int currfp_n() { return isize(currfp.matrices); } | ||||||
| int currfp_get_R() { return currfp.matcode[currfp.R]; } | EX int currfp_get_R() { return currfp.matcode[currfp.R]; } | ||||||
| int currfp_get_P() { return currfp.matcode[currfp.P]; } | EX int currfp_get_P() { return currfp.matcode[currfp.P]; } | ||||||
| int currfp_get_X() { return currfp.matcode[currfp.X]; } | EX int currfp_get_X() { return currfp.matcode[currfp.X]; } | ||||||
|  |  | ||||||
| } | } | ||||||
| #endif | #endif | ||||||
|   | |||||||
| @@ -678,11 +678,11 @@ void geometry_information::generate_floorshapes() { | |||||||
|   } |   } | ||||||
|  |  | ||||||
| #if CAP_GP | #if CAP_GP | ||||||
| namespace gp { | EX namespace gp { | ||||||
|   int pshid[3][8][32][32][8]; |   int pshid[3][8][32][32][8]; | ||||||
|   int nextid; |   int nextid; | ||||||
|    |    | ||||||
|   void clear_plainshapes() { |   EX void clear_plainshapes() { | ||||||
|     for(int m=0; m<3; m++) |     for(int m=0; m<3; m++) | ||||||
|     for(int sd=0; sd<8; sd++) |     for(int sd=0; sd<8; sd++) | ||||||
|     for(int i=0; i<32; i++) |     for(int i=0; i<32; i++) | ||||||
| @@ -731,7 +731,7 @@ namespace gp { | |||||||
|     if(id == -1) build_plainshape(id, draw_li, c, siid, sidir); |     if(id == -1) build_plainshape(id, draw_li, c, siid, sidir); | ||||||
|     return id; |     return id; | ||||||
|     } |     } | ||||||
|   } |   EX } | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| qfloorinfo qfi; | qfloorinfo qfi; | ||||||
|   | |||||||
							
								
								
									
										6
									
								
								game.cpp
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								game.cpp
									
									
									
									
									
								
							| @@ -5211,6 +5211,10 @@ EX void movemutant() { | |||||||
|     }   |     }   | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  | #if HDR | ||||||
|  | #define SHSIZE 16 | ||||||
|  | #endif | ||||||
|  |  | ||||||
| EX vector<array<cell*, MAXPLAYER>> shpos; | EX vector<array<cell*, MAXPLAYER>> shpos; | ||||||
| EX int cshpos = 0; | EX int cshpos = 0; | ||||||
|  |  | ||||||
| @@ -7726,7 +7730,7 @@ EX void terracotta() { | |||||||
|       } |       } | ||||||
|   } |   } | ||||||
|  |  | ||||||
| eMonster passive_switch = moSwitch2; | EX eMonster passive_switch = moSwitch2; | ||||||
|  |  | ||||||
| EX void checkSwitch() { | EX void checkSwitch() { | ||||||
|   passive_switch = (gold() & 1) ? moSwitch1 : moSwitch2; |   passive_switch = (gold() & 1) ? moSwitch1 : moSwitch2; | ||||||
|   | |||||||
| @@ -265,7 +265,7 @@ void showTorusConfig() { | |||||||
|   dialog::display(); |   dialog::display(); | ||||||
|   } |   } | ||||||
|  |  | ||||||
| string bitruncnames[5] = {" (b)", " (n)", " (g)", " (i)", " (d)"}; | EX string bitruncnames[5] = {" (b)", " (n)", " (g)", " (i)", " (d)"}; | ||||||
|  |  | ||||||
| void validity_info() { | void validity_info() { | ||||||
|   int vccolors[4] = {0xFF0000, 0xFF8000, 0xFFFF00, 0x00FF00}; |   int vccolors[4] = {0xFF0000, 0xFF8000, 0xFFFF00, 0x00FF00}; | ||||||
| @@ -815,7 +815,7 @@ EX void showEuclideanMenu() { | |||||||
|   dialog::display(); |   dialog::display(); | ||||||
|   } |   } | ||||||
|  |  | ||||||
| void runGeometryExperiments() { | EX void runGeometryExperiments() { | ||||||
|   if(!geometry && specialland == laIce) |   if(!geometry && specialland == laIce) | ||||||
|     specialland = getLandForList(cwt.at); |     specialland = getLandForList(cwt.at); | ||||||
|   pushScreen(showEuclideanMenu); |   pushScreen(showEuclideanMenu); | ||||||
|   | |||||||
							
								
								
									
										17
									
								
								geometry.cpp
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								geometry.cpp
									
									
									
									
									
								
							| @@ -17,6 +17,8 @@ struct usershapelayer { | |||||||
|   PPR prio; |   PPR prio; | ||||||
|   }; |   }; | ||||||
|  |  | ||||||
|  | extern int usershape_changes; | ||||||
|  |  | ||||||
| static const int USERLAYERS = 32; | static const int USERLAYERS = 32; | ||||||
|  |  | ||||||
| struct usershape { usershapelayer d[USERLAYERS]; }; | struct usershape { usershapelayer d[USERLAYERS]; }; | ||||||
| @@ -32,6 +34,19 @@ struct hpcshape { | |||||||
|   void clear() { s = e = shs = she = texture_offset = 0; prio = PPR::ZERO; tinf = NULL; flags = 0; } |   void clear() { s = e = shs = she = texture_offset = 0; prio = PPR::ZERO; tinf = NULL; flags = 0; } | ||||||
|   }; |   }; | ||||||
|  |  | ||||||
|  | #define SIDE_SLEV 0 | ||||||
|  | #define SIDE_WTS3 3 | ||||||
|  | #define SIDE_WALL 4 | ||||||
|  | #define SIDE_LAKE 5 | ||||||
|  | #define SIDE_LTOB 6 | ||||||
|  | #define SIDE_BTOI 7 | ||||||
|  | #define SIDE_SKY  8 | ||||||
|  | #define SIDE_HIGH 9 | ||||||
|  | #define SIDE_HIGH2 10 | ||||||
|  | #define SIDEPARS  11 | ||||||
|  |  | ||||||
|  | #define BADMODEL 0 | ||||||
|  |  | ||||||
| static const int WINGS = (BADMODEL ? 1 : 4); | static const int WINGS = (BADMODEL ? 1 : 4); | ||||||
|  |  | ||||||
| typedef array<hpcshape, WINGS+1> hpcshape_animated; | typedef array<hpcshape, WINGS+1> hpcshape_animated; | ||||||
| @@ -54,6 +69,8 @@ struct plain_floorshape : floorshape { | |||||||
|   void configure(ld r0, ld r1) { rad0 = r0; rad1 = r1; } |   void configure(ld r0, ld r1) { rad0 = r0; rad1 = r1; } | ||||||
|   }; |   }; | ||||||
|  |  | ||||||
|  | extern vector<ld> equal_weights; | ||||||
|  |  | ||||||
| // noftype: 0 (shapeid2 is heptagonal or just use shapeid1), 1 (shapeid2 is pure heptagonal), 2 (shapeid2 is Euclidean), 3 (shapeid2 is hexagonal) | // noftype: 0 (shapeid2 is heptagonal or just use shapeid1), 1 (shapeid2 is pure heptagonal), 2 (shapeid2 is Euclidean), 3 (shapeid2 is hexagonal) | ||||||
| struct escher_floorshape : floorshape { | struct escher_floorshape : floorshape { | ||||||
|   int shapeid0, shapeid1, noftype, shapeid2; |   int shapeid0, shapeid1, noftype, shapeid2; | ||||||
|   | |||||||
							
								
								
									
										28
									
								
								graph.cpp
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								graph.cpp
									
									
									
									
									
								
							| @@ -3288,7 +3288,7 @@ ld wavefun(ld x) { | |||||||
|   else return 0; */ |   else return 0; */ | ||||||
|   } |   } | ||||||
|  |  | ||||||
| colortable nestcolors = { 0x800000, 0x008000, 0x000080, 0x404040, 0x700070, 0x007070, 0x707000, 0x606060 }; | EX colortable nestcolors = { 0x800000, 0x008000, 0x000080, 0x404040, 0x700070, 0x007070, 0x707000, 0x606060 }; | ||||||
|  |  | ||||||
| color_t floorcolors[landtypes]; | color_t floorcolors[landtypes]; | ||||||
|  |  | ||||||
| @@ -4264,7 +4264,7 @@ void draw_wall(cell *c, const transmatrix& V, color_t wcol, color_t& zcol, int c | |||||||
|   } |   } | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| bool just_gmatrix; | EX bool just_gmatrix; | ||||||
|  |  | ||||||
| int colorhash(color_t i) { | int colorhash(color_t i) { | ||||||
|   return (i * 0x471211 + i*i*0x124159 + i*i*i*0x982165) & 0xFFFFFF; |   return (i * 0x471211 + i*i*0x124159 + i*i*i*0x982165) & 0xFFFFFF; | ||||||
| @@ -4342,7 +4342,7 @@ void draw_gravity_particles(cell *c, const transmatrix V) { | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
| bool isWall3(cell *c, color_t& wcol) { | EX bool isWall3(cell *c, color_t& wcol) { | ||||||
|   if(isWall(c)) return true; |   if(isWall(c)) return true; | ||||||
|   if(c->wall == waChasm && c->land == laMemory) { wcol = 0x606000; return true; } |   if(c->wall == waChasm && c->land == laMemory) { wcol = 0x606000; return true; } | ||||||
|   if(c->wall == waInvisibleFloor) return false; |   if(c->wall == waInvisibleFloor) return false; | ||||||
| @@ -7688,6 +7688,28 @@ inline void popScreen() { if(isize(screens)>1) screens.pop_back(); } | |||||||
| inline void popScreenAll() { while(isize(screens)>1) popScreen(); } | inline void popScreenAll() { while(isize(screens)>1) popScreen(); } | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | #if HDR | ||||||
|  | namespace sm { | ||||||
|  |   static const int NORMAL = 1; | ||||||
|  |   static const int MISSION = 2; | ||||||
|  |   static const int HELP = 4; | ||||||
|  |   static const int MAP = 8; | ||||||
|  |   static const int DRAW = 16; | ||||||
|  |   static const int NUMBER = 32; | ||||||
|  |   static const int SHMUPCONFIG = 64; | ||||||
|  |   static const int OVERVIEW = 128; | ||||||
|  |   static const int SIDE = 256; | ||||||
|  |   static const int DOTOUR = 512; | ||||||
|  |   static const int CENTER = 1024; | ||||||
|  |   static const int ZOOMABLE = 4096; | ||||||
|  |   static const int TORUSCONFIG = 8192; | ||||||
|  |   static const int MAYDARK = 16384; | ||||||
|  |   static const int DIALOG_STRICT_X = 32768; // do not interpret dialog clicks outside of the X region | ||||||
|  |   static const int EXPANSION = (1<<16); | ||||||
|  |   static const int HEXEDIT = (1<<17); | ||||||
|  |   }; | ||||||
|  | #endif | ||||||
|  |  | ||||||
| EX int cmode; | EX int cmode; | ||||||
|  |  | ||||||
| EX void drawscreen() { | EX void drawscreen() { | ||||||
|   | |||||||
							
								
								
									
										343
									
								
								hyper.h
									
									
									
									
									
								
							
							
						
						
									
										343
									
								
								hyper.h
									
									
									
									
									
								
							| @@ -321,8 +321,6 @@ extern videopar vid; | |||||||
| #define self (*this) | #define self (*this) | ||||||
|  |  | ||||||
| extern int cellcount, heptacount; | extern int cellcount, heptacount; | ||||||
| extern color_t forecolor; |  | ||||||
| extern ld band_shift; |  | ||||||
| // cell information for the game | // cell information for the game | ||||||
|  |  | ||||||
| struct gcell { | struct gcell { | ||||||
| @@ -682,18 +680,6 @@ template<class T> int isize(const T& x) {return x.size(); } | |||||||
| namespace anticheat { extern bool tampered; } | namespace anticheat { extern bool tampered; } | ||||||
| #define HRANDMAX 0x7FFFFFFF | #define HRANDMAX 0x7FFFFFFF | ||||||
|  |  | ||||||
| namespace hive { void createBugArmy(cell *c); } |  | ||||||
| namespace whirlpool { void generate(cell *wto); } |  | ||||||
| namespace whirlwind { void generate(cell *wto); } |  | ||||||
| namespace mirror {  |  | ||||||
|   static const int SPINSINGLE = 1; |  | ||||||
|   static const int SPINMULTI = 2; |  | ||||||
|   static const int GO = 4; |  | ||||||
|   static const int ATTACK = 8; |  | ||||||
|      |  | ||||||
|   void act(int dir, int flags); |  | ||||||
|   } |  | ||||||
|  |  | ||||||
| struct movedir {  | struct movedir {  | ||||||
|   int d;  |   int d;  | ||||||
|   // non-negative numbers denote 'rotate +d steps and act in this direction |   // non-negative numbers denote 'rotate +d steps and act in this direction | ||||||
| @@ -746,12 +732,6 @@ typedef flagtype modecode_t; | |||||||
|  |  | ||||||
| #define GUNRANGE 3 | #define GUNRANGE 3 | ||||||
|  |  | ||||||
| // 0 = basic treasure, 1 = other item, 2 = power orb, 3 = not an item |  | ||||||
| #define IC_TREASURE 0 |  | ||||||
| #define IC_OTHER 1 |  | ||||||
| #define IC_ORB 2 |  | ||||||
| #define IC_NAI 3 |  | ||||||
|  |  | ||||||
| // loops | // loops | ||||||
|  |  | ||||||
| #define fakecellloop(ct) for(cell *ct = (cell*)1; ct; ct=NULL) | #define fakecellloop(ct) for(cell *ct = (cell*)1; ct; ct=NULL) | ||||||
| @@ -931,153 +911,16 @@ inline int operator - (PPR x, PPR y) { return int(x) - int(y); } | |||||||
| #define OUTLINE_FORE     ((forecolor << 8) + 0xFF) | #define OUTLINE_FORE     ((forecolor << 8) + 0xFF) | ||||||
| #define OUTLINE_BACK     ((backcolor << 8) + 0xFF) | #define OUTLINE_BACK     ((backcolor << 8) + 0xFF) | ||||||
|  |  | ||||||
| #define IFM(x) (mousing?"":x) |  | ||||||
|  |  | ||||||
| enum orbAction { roMouse, roKeyboard, roCheck, roMouseForce, roMultiCheck, roMultiGo }; | enum orbAction { roMouse, roKeyboard, roCheck, roMouseForce, roMultiCheck, roMultiGo }; | ||||||
|  |  | ||||||
| #define MODELCOUNT ((int) mdGUARD) | #define MODELCOUNT ((int) mdGUARD) | ||||||
|  |  | ||||||
| void drawShape(pair<ld,ld>* coords, int qty, color_t color); |  | ||||||
|  |  | ||||||
| #define pmodel (vid.vpmodel) | #define pmodel (vid.vpmodel) | ||||||
|  |  | ||||||
| color_t darkena(color_t c, int lev, int a); | color_t darkena(color_t c, int lev, int a); | ||||||
|  |  | ||||||
| #define SHSIZE 16 |  | ||||||
|  |  | ||||||
| #if CAP_TOUR |  | ||||||
| namespace tour { |  | ||||||
|   extern bool on; |  | ||||||
|   extern string tourhelp; |  | ||||||
|   extern string slidecommand; |  | ||||||
|   extern int currentslide; |  | ||||||
|    |  | ||||||
|   enum presmode {  |  | ||||||
|     pmStartAll = 0, |  | ||||||
|     pmStart = 1, pmFrame = 2, pmStop = 3, pmKey = 4, pmRestart = 5, |  | ||||||
|     pmAfterFrame = 6, |  | ||||||
|     pmGeometry = 11, pmGeometryReset = 13, pmGeometryStart = 15 |  | ||||||
|     }; |  | ||||||
|  |  | ||||||
|   void setCanvas(presmode mode, char canv); |  | ||||||
|  |  | ||||||
|   void presentation(presmode mode); |  | ||||||
|   void checkGoodLand(eLand l); |  | ||||||
|   int getid(); |  | ||||||
|    |  | ||||||
|   extern function<eLand(eLand)> getNext; |  | ||||||
|   extern function<bool(eLand)> quickfind; |  | ||||||
|   extern function<bool(eLand)> showland; |  | ||||||
|  |  | ||||||
|   void start(); |  | ||||||
|  |  | ||||||
|   struct slide {  |  | ||||||
|     const char *name; int unused_id; int flags; const char *help;  |  | ||||||
|     function<void(presmode mode)> action; |  | ||||||
|     } ; |  | ||||||
|    |  | ||||||
|   extern slide *slides; |  | ||||||
|   extern slide default_slides[]; |  | ||||||
|  |  | ||||||
|   static const int LEGAL_NONE=0; |  | ||||||
|   static const int LEGAL_UNLIMITED=1; |  | ||||||
|   static const int LEGAL_HYPERBOLIC=2; |  | ||||||
|   static const int LEGAL_ANY=3; |  | ||||||
|   static const int LEGAL_NONEUC=4; |  | ||||||
|   static const int QUICKSKIP=8; |  | ||||||
|   static const int FINALSLIDE=16; |  | ||||||
|   static const int QUICKGEO=32; |  | ||||||
|   static const int SIDESCREEN = 64; |  | ||||||
|   static const int USE_SLIDE_NAME = 128; |  | ||||||
|    |  | ||||||
|   extern slide slideHypersian; |  | ||||||
|   extern slide slideExpansion; |  | ||||||
|  |  | ||||||
|   namespace ss { |  | ||||||
|     void showMenu(); |  | ||||||
|     void list(slide*); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|   extern hookset<void(int)> *hooks_slide; |  | ||||||
|   }; |  | ||||||
| #else |  | ||||||
| namespace tour { |  | ||||||
|   static const always_false on; |  | ||||||
|   } |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| namespace sm { |  | ||||||
|   static const int NORMAL = 1; |  | ||||||
|   static const int MISSION = 2; |  | ||||||
|   static const int HELP = 4; |  | ||||||
|   static const int MAP = 8; |  | ||||||
|   static const int DRAW = 16; |  | ||||||
|   static const int NUMBER = 32; |  | ||||||
|   static const int SHMUPCONFIG = 64; |  | ||||||
|   static const int OVERVIEW = 128; |  | ||||||
|   static const int SIDE = 256; |  | ||||||
|   static const int DOTOUR = 512; |  | ||||||
|   static const int CENTER = 1024; |  | ||||||
|   static const int ZOOMABLE = 4096; |  | ||||||
|   static const int TORUSCONFIG = 8192; |  | ||||||
|   static const int MAYDARK = 16384; |  | ||||||
|   static const int DIALOG_STRICT_X = 32768; // do not interpret dialog clicks outside of the X region |  | ||||||
|   static const int EXPANSION = (1<<16); |  | ||||||
|   static const int HEXEDIT = (1<<17); |  | ||||||
|   }; |  | ||||||
|  |  | ||||||
| namespace linepatterns { |  | ||||||
|  |  | ||||||
|   enum ePattern { |  | ||||||
|     patPalacelike, |  | ||||||
|     patPalace, |  | ||||||
|     patZebraTriangles, |  | ||||||
|     patZebraLines, |  | ||||||
|     patTriTree, |  | ||||||
|     patTriRings, |  | ||||||
|     patHepta, |  | ||||||
|     patRhomb, |  | ||||||
|     patTree, |  | ||||||
|     patAltTree, |  | ||||||
|     patVine, |  | ||||||
|     patPower, |  | ||||||
|     patNormal, |  | ||||||
|     patTrihepta, |  | ||||||
|     patBigTriangles, |  | ||||||
|     patBigRings, |  | ||||||
|     patHorocycles, |  | ||||||
|     patTriOther, |  | ||||||
|     patDual, |  | ||||||
|     patMeridians, |  | ||||||
|     patParallels, |  | ||||||
|     patCircles, |  | ||||||
|     patRadii |  | ||||||
|     }; |  | ||||||
|    |  | ||||||
|   void clearAll(); |  | ||||||
|   void setColor(ePattern id, color_t col); |  | ||||||
|   void drawAll(); |  | ||||||
|   void showMenu(); |  | ||||||
|   void switchAlpha(ePattern id, color_t col); |  | ||||||
|  |  | ||||||
|   struct linepattern { |  | ||||||
|     int id; |  | ||||||
|     const char *lpname; |  | ||||||
|     color_t color; |  | ||||||
|     ld multiplier; |  | ||||||
|     }; |  | ||||||
|  |  | ||||||
|   extern vector<linepattern> patterns; |  | ||||||
|   extern ld width; |  | ||||||
|   }; |  | ||||||
|  |  | ||||||
| static const int DISTANCE_UNKNOWN = 127; | static const int DISTANCE_UNKNOWN = 127; | ||||||
|  |  | ||||||
| #define SETMOUSEKEY 5000 |  | ||||||
| extern char mousekey; |  | ||||||
| extern char newmousekey; |  | ||||||
| void displaymm(char c, int x, int y, int rad, int size, const string& title, int align); |  | ||||||
|  |  | ||||||
| #include <functional> | #include <functional> | ||||||
|  |  | ||||||
| template<class T, class U> int addHook(hookset<T>*& m, int prio, const U& hook) { | template<class T, class U> int addHook(hookset<T>*& m, int prio, const U& hook) { | ||||||
| @@ -1152,22 +995,6 @@ extern bool useRangedOrb; | |||||||
|  |  | ||||||
| static inline bool orbProtection(eItem it) { return false; } // not implemented | static inline bool orbProtection(eItem it) { return false; } // not implemented | ||||||
|  |  | ||||||
| #if CAP_FIELD |  | ||||||
| namespace windmap { |  | ||||||
|   void create(); |  | ||||||
|  |  | ||||||
|   static const int NOWINDBELOW = 8; |  | ||||||
|   static const int NOWINDFROM = 120; |  | ||||||
|  |  | ||||||
|   int getId(cell *c); |  | ||||||
|   int at(cell *c); |  | ||||||
|   } |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| int getgametime(); |  | ||||||
| string getgametime_s(int timespent = getgametime()); |  | ||||||
| extern int stampbase; |  | ||||||
|  |  | ||||||
| #ifndef GL | #ifndef GL | ||||||
| typedef float GLfloat; | typedef float GLfloat; | ||||||
| #endif | #endif | ||||||
| @@ -1249,73 +1076,10 @@ struct celllister : manual_celllister { | |||||||
|   int getdist(cell *c) { return dists[c->listindex]; } |   int getdist(cell *c) { return dists[c->listindex]; } | ||||||
|   }; |   }; | ||||||
|  |  | ||||||
| #if CAP_FIELD |  | ||||||
| #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); |  | ||||||
|  |  | ||||||
| int currfp_n(); |  | ||||||
| int currfp_get_P(); |  | ||||||
| int currfp_get_R(); |  | ||||||
| int currfp_get_X(); |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| void runGeometryExperiments(); |  | ||||||
|  |  | ||||||
| // z to close to this limit => do not draw | // z to close to this limit => do not draw | ||||||
|  |  | ||||||
| #define BEHIND_LIMIT 1e-6 | #define BEHIND_LIMIT 1e-6 | ||||||
|  |  | ||||||
| namespace lv { |  | ||||||
|   static const flagtype appears_in_geom_exp = 1; |  | ||||||
|   static const flagtype display_error_message = 2; |  | ||||||
|   static const flagtype appears_in_full = 4; |  | ||||||
|   static const flagtype appears_in_ptm = 8; |  | ||||||
|   static const flagtype display_in_help = 16; |  | ||||||
|   static const flagtype one_and_half = 32; |  | ||||||
|   }; |  | ||||||
|  |  | ||||||
| struct land_validity_t { |  | ||||||
|   int quality_level; // 0 (dont show), 1 (1/2), 2 (ok), 3(1!) |  | ||||||
|   flagtype flags; |  | ||||||
|   string msg; |  | ||||||
|   }; |  | ||||||
|  |  | ||||||
| namespace fieldpattern { |  | ||||||
|   pair<int, bool> fieldval(cell *c); |  | ||||||
|   } |  | ||||||
|  |  | ||||||
| int emeraldval(cell *c); |  | ||||||
|  |  | ||||||
| int inpair(cell *c, int colorpair); |  | ||||||
| int snake_pair(cell *c); |  | ||||||
|  |  | ||||||
| extern colortable nestcolors; |  | ||||||
|  |  | ||||||
| unsigned char& part(color_t& col, int i); |  | ||||||
|  |  | ||||||
| int pattern_threecolor(cell *c); |  | ||||||
| int fiftyval200(cell *c); |  | ||||||
|  |  | ||||||
| bool isWall3(cell *c, color_t& wcol); |  | ||||||
|  |  | ||||||
| extern string bitruncnames[5]; |  | ||||||
| extern bool need_mouseh; |  | ||||||
|  |  | ||||||
| void clear_euland(eLand first); |  | ||||||
|  |  | ||||||
| extern eMonster passive_switch; |  | ||||||
|  |  | ||||||
| bool cannotPickupItem(cell *c, bool telekinesis); |  | ||||||
| bool canPickupItemWithMagnetism(cell *c, cell *from); |  | ||||||
| void pickupMovedItems(cell *c); |  | ||||||
| eMonster genRuinMonster(cell *c); |  | ||||||
|  |  | ||||||
| template<class T, class U> void eliminate_if(vector<T>& data, U pred) { | template<class T, class U> void eliminate_if(vector<T>& data, U pred) { | ||||||
|   for(int i=0; i<isize(data); i++) |   for(int i=0; i<isize(data); i++) | ||||||
|     if(pred(data[i])) |     if(pred(data[i])) | ||||||
| @@ -1326,34 +1090,6 @@ template<class T, class U> void eliminate_if(vector<T>& data, U pred) { | |||||||
| transmatrix getOrientation(); | transmatrix getOrientation(); | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| namespace elec { extern int lightningfast; } |  | ||||||
|  |  | ||||||
| #define DF_INIT              1 // always display these |  | ||||||
| #define DF_MSG               2 // always display these |  | ||||||
| #define DF_WARN              4 // always display these |  | ||||||
| #define DF_ERROR             8 // always display these |  | ||||||
| #define DF_STEAM            16 |  | ||||||
| #define DF_GRAPH            32 |  | ||||||
| #define DF_TURN             64 |  | ||||||
| #define DF_FIELD           128 |  | ||||||
| #define DF_GEOM            256 |  | ||||||
| #define DF_MEMORY          512 |  | ||||||
| #define DF_TIME           1024 // a flag to display timestamps |  | ||||||
| #define DF_GP             2048 |  | ||||||
| #define DF_POLY           4096 |  | ||||||
| #define DF_LOG            8192 |  | ||||||
| #define DF_KEYS "imwesxufgbtopl" |  | ||||||
|  |  | ||||||
| #if ISANDROID |  | ||||||
| #define DEBB(r,x) |  | ||||||
| #define DEBB0(r,x) |  | ||||||
| #define DEBBI(r,x) |  | ||||||
| #else |  | ||||||
| #define DEBB(r,x) { if(debugflags & (r)) { println_log x; } } |  | ||||||
| #define DEBB0(r,x) { if(debugflags & (r)) { print_log x; } } |  | ||||||
| #define DEBBI(r,x) { if(debugflags & (r)) { println_log x; } } indenter_finish _debbi(debugflags & (r)); |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| template<class T> array<T, 4> make_array(T a, T b, T c, T d) { array<T,4> x; x[0] = a; x[1] = b; x[2] = c; x[3] = d; return x; } | template<class T> array<T, 4> make_array(T a, T b, T c, T d) { array<T,4> x; x[0] = a; x[1] = b; x[2] = c; x[3] = d; return x; } | ||||||
| template<class T> array<T, 3> make_array(T a, T b, T c) { array<T,3> x; x[0] = a; x[1] = b; x[2] = c; return x; } | template<class T> array<T, 3> make_array(T a, T b, T c) { array<T,3> x; x[0] = a; x[1] = b; x[2] = c; return x; } | ||||||
| template<class T> array<T, 2> make_array(T a, T b) { array<T,2> x; x[0] = a; x[1] = b; return x; } | template<class T> array<T, 2> make_array(T a, T b) { array<T,2> x; x[0] = a; x[1] = b; return x; } | ||||||
| @@ -1372,85 +1108,6 @@ namespace daily { | |||||||
|   void uploadscore(bool really_final); |   void uploadscore(bool really_final); | ||||||
|   } |   } | ||||||
|  |  | ||||||
| namespace torusconfig { |  | ||||||
|   extern int sdx, sdy; |  | ||||||
|    |  | ||||||
|   enum eTorusMode : char {  |  | ||||||
|     tmSingleHex,  |  | ||||||
|     tmSingle,  |  | ||||||
|     tmSlantedHex,  |  | ||||||
|     tmStraight,  |  | ||||||
|     tmStraightHex, |  | ||||||
|     tmKlein, |  | ||||||
|     tmKleinHex, |  | ||||||
|     tmCylinder, |  | ||||||
|     tmCylinderHex, |  | ||||||
|     tmMobius, |  | ||||||
|     tmMobiusHex, |  | ||||||
|     }; |  | ||||||
|    |  | ||||||
|   extern eTorusMode torus_mode; |  | ||||||
|   extern void activate(); |  | ||||||
|  |  | ||||||
|   struct torusmode_info { |  | ||||||
|     string name; |  | ||||||
|     flagtype flags; |  | ||||||
|     }; |  | ||||||
|    |  | ||||||
|   extern vector<torusmode_info> tmodes; |  | ||||||
|  |  | ||||||
|   enum : flagtype { |  | ||||||
|     TF_SINGLE = 1, |  | ||||||
|     TF_SIMPLE = 2, |  | ||||||
|     TF_WEIRD  = 4, |  | ||||||
|     TF_HEX    = 16, |  | ||||||
|     TF_SQUARE = 32, |  | ||||||
|     TF_CYL    = 64, |  | ||||||
|     TF_KLEIN = 256, |  | ||||||
|     }; |  | ||||||
|  |  | ||||||
|   flagtype tmflags(); |  | ||||||
|   } |  | ||||||
|  |  | ||||||
| struct plainshape; |  | ||||||
| void clear_plainshape(plainshape& gsh); |  | ||||||
|  |  | ||||||
| namespace gp { |  | ||||||
|   void clear_plainshapes(); |  | ||||||
|   plainshape& get_plainshape(); |  | ||||||
|   } |  | ||||||
|  |  | ||||||
| extern bool just_gmatrix; |  | ||||||
|  |  | ||||||
| bool haveLeaderboard(int id); |  | ||||||
| int get_currentscore(int id); |  | ||||||
| void set_priority_board(int id); |  | ||||||
| int get_sync_status(); |  | ||||||
| bool score_loaded(int id); |  | ||||||
| int score_default(int id); |  | ||||||
| void handle_event(SDL_Event& ev); |  | ||||||
|  |  | ||||||
| void generate_floorshapes(); |  | ||||||
|  |  | ||||||
| #define SIDE_SLEV 0 |  | ||||||
| #define SIDE_WTS3 3 |  | ||||||
| #define SIDE_WALL 4 |  | ||||||
| #define SIDE_LAKE 5 |  | ||||||
| #define SIDE_LTOB 6 |  | ||||||
| #define SIDE_BTOI 7 |  | ||||||
| #define SIDE_SKY  8 |  | ||||||
| #define SIDE_HIGH 9 |  | ||||||
| #define SIDE_HIGH2 10 |  | ||||||
| #define SIDEPARS  11 |  | ||||||
|  |  | ||||||
| void initShape(int sg, int id); |  | ||||||
|  |  | ||||||
| extern int usershape_changes; |  | ||||||
|  |  | ||||||
| #define BADMODEL 0 |  | ||||||
|  |  | ||||||
| extern vector<ld> equal_weights; |  | ||||||
|  |  | ||||||
| #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)) | ||||||
| #define REVRING(i) for(double i=cgi.S84; i>=-1e-6; i-=SD3 * pow(.5, vid.linequality)) | #define REVRING(i) for(double i=cgi.S84; i>=-1e-6; i-=SD3 * pow(.5, vid.linequality)) | ||||||
| #define PRING(i) for(double i=0; i<=cgi.S84+1e-6; i+= pow(.5, vid.linequality)) | #define PRING(i) for(double i=0; i<=cgi.S84+1e-6; i+= pow(.5, vid.linequality)) | ||||||
|   | |||||||
| @@ -96,7 +96,7 @@ bool out_ruin(cell *c) { | |||||||
|   #endif |   #endif | ||||||
|   } |   } | ||||||
|  |  | ||||||
| eMonster genRuinMonster(cell *c) { | EX eMonster genRuinMonster(cell *c) { | ||||||
|   eMonster m = pick(moHexDemon, moHexDemon, moHexDemon, moAltDemon, moAltDemon, moMonk, moMonk, moSkeleton, moSkeleton, moCrusher); |   eMonster m = pick(moHexDemon, moHexDemon, moHexDemon, moAltDemon, moAltDemon, moMonk, moMonk, moSkeleton, moSkeleton, moCrusher); | ||||||
|   if(m == moHexDemon && pseudohept(c)) |   if(m == moHexDemon && pseudohept(c)) | ||||||
|     return genRuinMonster(c); |     return genRuinMonster(c); | ||||||
|   | |||||||
							
								
								
									
										17
									
								
								landlock.cpp
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								landlock.cpp
									
									
									
									
									
								
							| @@ -560,6 +560,23 @@ template<class T> void generateLandList(T t) { | |||||||
|   } |   } | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | #if HDR | ||||||
|  | namespace lv { | ||||||
|  |   static const flagtype appears_in_geom_exp = 1; | ||||||
|  |   static const flagtype display_error_message = 2; | ||||||
|  |   static const flagtype appears_in_full = 4; | ||||||
|  |   static const flagtype appears_in_ptm = 8; | ||||||
|  |   static const flagtype display_in_help = 16; | ||||||
|  |   static const flagtype one_and_half = 32; | ||||||
|  |   }; | ||||||
|  |  | ||||||
|  | struct land_validity_t { | ||||||
|  |   int quality_level; // 0 (dont show), 1 (1/2), 2 (ok), 3(1!) | ||||||
|  |   flagtype flags; | ||||||
|  |   string msg; | ||||||
|  |   }; | ||||||
|  | #endif | ||||||
|  |  | ||||||
| EX 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; | ||||||
|   | |||||||
| @@ -23,8 +23,6 @@ void mark_file() { | |||||||
|     } |     } | ||||||
|   while(ifs_level < (int) if_stack.size()) |   while(ifs_level < (int) if_stack.size()) | ||||||
|     cout << ind() << if_stack[ifs_level++] << "\n"; |     cout << ind() << if_stack[ifs_level++] << "\n"; | ||||||
|   while(ifs_level > (int) if_stack.size()) |  | ||||||
|     cout << ind() << "#endif\n", ifs_level--; |  | ||||||
|   } |   } | ||||||
|  |  | ||||||
| int in_hdr; | int in_hdr; | ||||||
| @@ -49,6 +47,7 @@ void gen(string s) { | |||||||
|       continue; |       continue; | ||||||
|       } |       } | ||||||
|     if(s == "#if HDR") { |     if(s == "#if HDR") { | ||||||
|  |       mark_file(); | ||||||
|       in_hdr = true; |       in_hdr = true; | ||||||
|       continue; |       continue; | ||||||
|       } |       } | ||||||
| @@ -62,6 +61,8 @@ void gen(string s) { | |||||||
|     if(s.substr(0, 6) == "#endif") { |     if(s.substr(0, 6) == "#endif") { | ||||||
|       if(if_stack.empty()) { cerr << "if_stack error " << which_file << ", " << s << "\n"; exit(1); } |       if(if_stack.empty()) { cerr << "if_stack error " << which_file << ", " << s << "\n"; exit(1); } | ||||||
|       if_stack.pop_back(); |       if_stack.pop_back(); | ||||||
|  |       while(ifs_level > (int) if_stack.size()) | ||||||
|  |         cout << ind() << "#endif\n", ifs_level--; | ||||||
|       } |       } | ||||||
|     if(s.substr(0, 4) == "EX }") { |     if(s.substr(0, 4) == "EX }") { | ||||||
|       mark_file(); |       mark_file(); | ||||||
|   | |||||||
| @@ -920,7 +920,7 @@ EX named_functionality get_o_key() { | |||||||
|  |  | ||||||
| int messagelogpos; | int messagelogpos; | ||||||
| int timeformat; | int timeformat; | ||||||
| int stampbase; | EX int stampbase; | ||||||
|  |  | ||||||
| EX string gettimestamp(msginfo& m) { | EX string gettimestamp(msginfo& m) { | ||||||
|   char buf[128];  |   char buf[128];  | ||||||
|   | |||||||
							
								
								
									
										65
									
								
								pattern2.cpp
									
									
									
									
									
								
							
							
						
						
									
										65
									
								
								pattern2.cpp
									
									
									
									
									
								
							| @@ -80,9 +80,9 @@ int chessvalue(cell *c) { | |||||||
|     return celldist(c) & 1; |     return celldist(c) & 1; | ||||||
|   } |   } | ||||||
|  |  | ||||||
| int emeraldval(heptagon *h) { return h->emeraldval >> 3; } | EX int emeraldval(heptagon *h) { return h->emeraldval >> 3; } | ||||||
|  |  | ||||||
| int emeraldval(cell *c) { | EX int emeraldval(cell *c) { | ||||||
|   if(euclid) return eupattern(c); |   if(euclid) return eupattern(c); | ||||||
|   if(sphere) return 0; |   if(sphere) return 0; | ||||||
|   if(ctof(c)) |   if(ctof(c)) | ||||||
| @@ -357,14 +357,14 @@ EX int zebra3(cell *c) { | |||||||
|   } |   } | ||||||
|  |  | ||||||
| #if CAP_FIELD | #if CAP_FIELD | ||||||
| namespace fieldpattern { | EX namespace fieldpattern { | ||||||
|  |  | ||||||
| pair<int, bool> fieldval(cell *c) { | EX pair<int, bool> fieldval(cell *c) { | ||||||
|   if(ctof(c)) return make_pair(int(c->master->fieldval), false); |   if(ctof(c)) return make_pair(int(c->master->fieldval), false); | ||||||
|   else return make_pair(btspin(c->master->fieldval, c->c.spin(0)), true); |   else return make_pair(btspin(c->master->fieldval, c->c.spin(0)), true); | ||||||
|   } |   } | ||||||
|  |  | ||||||
| int fieldval_uniq(cell *c) { | EX int fieldval_uniq(cell *c) { | ||||||
|   if(sphere) { |   if(sphere) { | ||||||
|     if(archimedean) return c->master->fiftyval; |     if(archimedean) return c->master->fiftyval; | ||||||
|     #if CAP_IRR |     #if CAP_IRR | ||||||
| @@ -395,7 +395,7 @@ int fieldval_uniq(cell *c) { | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
| int fieldval_uniq_rand(cell *c, int randval) { | EX int fieldval_uniq_rand(cell *c, int randval) { | ||||||
|   if(sphere || euclid || NONSTDVAR)  |   if(sphere || euclid || NONSTDVAR)  | ||||||
|     // we do not care in these cases |     // we do not care in these cases | ||||||
|     return fieldval_uniq(c); |     return fieldval_uniq(c); | ||||||
| @@ -432,7 +432,7 @@ pair<int, int> subval(cell *c, int _subpathid = subpathid, int _subpathorder = s | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
| } | EX } | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| int getHemisphere(heptagon *h, int which) { | int getHemisphere(heptagon *h, int which) { | ||||||
| @@ -1236,7 +1236,7 @@ EX int geosupport_football() { | |||||||
|   return 0; |   return 0; | ||||||
|   } |   } | ||||||
|  |  | ||||||
| int pattern_threecolor(cell *c) { | EX int pattern_threecolor(cell *c) { | ||||||
|   #if CAP_ARCM |   #if CAP_ARCM | ||||||
|   if(archimedean) { |   if(archimedean) { | ||||||
|     if(PURE) |     if(PURE) | ||||||
| @@ -2164,7 +2164,42 @@ bool is_master(cell *c) { | |||||||
|   else return c->master->c7 == c; |   else return c->master->c7 == c; | ||||||
|   } |   } | ||||||
|  |  | ||||||
| namespace linepatterns { | EX namespace linepatterns { | ||||||
|  |  | ||||||
|  |   #if HDR | ||||||
|  |   enum ePattern { | ||||||
|  |     patPalacelike, | ||||||
|  |     patPalace, | ||||||
|  |     patZebraTriangles, | ||||||
|  |     patZebraLines, | ||||||
|  |     patTriTree, | ||||||
|  |     patTriRings, | ||||||
|  |     patHepta, | ||||||
|  |     patRhomb, | ||||||
|  |     patTree, | ||||||
|  |     patAltTree, | ||||||
|  |     patVine, | ||||||
|  |     patPower, | ||||||
|  |     patNormal, | ||||||
|  |     patTrihepta, | ||||||
|  |     patBigTriangles, | ||||||
|  |     patBigRings, | ||||||
|  |     patHorocycles, | ||||||
|  |     patTriOther, | ||||||
|  |     patDual, | ||||||
|  |     patMeridians, | ||||||
|  |     patParallels, | ||||||
|  |     patCircles, | ||||||
|  |     patRadii | ||||||
|  |     }; | ||||||
|  |  | ||||||
|  |   struct linepattern { | ||||||
|  |     int id; | ||||||
|  |     const char *lpname; | ||||||
|  |     color_t color; | ||||||
|  |     ld multiplier; | ||||||
|  |     }; | ||||||
|  |   #endif | ||||||
|  |  | ||||||
|   color_t lessalpha(color_t col, int m) { |   color_t lessalpha(color_t col, int m) { | ||||||
|     part(col, 0) /= m; |     part(col, 0) /= m; | ||||||
| @@ -2181,7 +2216,7 @@ namespace linepatterns { | |||||||
|     return col; |     return col; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|   vector<linepattern> patterns = { |   EX vector<linepattern> patterns = { | ||||||
|  |  | ||||||
|     {patDual, "dual grid", 0xFFFFFF00, 1}, |     {patDual, "dual grid", 0xFFFFFF00, 1}, | ||||||
|  |  | ||||||
| @@ -2222,12 +2257,12 @@ namespace linepatterns { | |||||||
|     return false; |     return false; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   void setColor(ePattern id, color_t col) { |   EX void setColor(ePattern id, color_t col) { | ||||||
|     for(auto& lp: patterns) |     for(auto& lp: patterns) | ||||||
|       if(lp.id == id) lp.color = col; |       if(lp.id == id) lp.color = col; | ||||||
|     } |     } | ||||||
|    |    | ||||||
|   void switchAlpha(ePattern id, color_t col) { |   EX void switchAlpha(ePattern id, color_t col) { | ||||||
|     for(auto& lp: patterns) |     for(auto& lp: patterns) | ||||||
|       if(lp.id == id) lp.color ^= col; |       if(lp.id == id) lp.color ^= col; | ||||||
|     } |     } | ||||||
| @@ -2467,9 +2502,9 @@ namespace linepatterns { | |||||||
|       } |       } | ||||||
|     }   |     }   | ||||||
|  |  | ||||||
|   ld width = 1; |   EX ld width = 1; | ||||||
|  |  | ||||||
|   void drawAll() { |   EX void drawAll() { | ||||||
|    |    | ||||||
|     vid.linewidth *= width; |     vid.linewidth *= width; | ||||||
|  |  | ||||||
| @@ -2535,7 +2570,7 @@ namespace linepatterns { | |||||||
|    |    | ||||||
|   bool indiv; |   bool indiv; | ||||||
|    |    | ||||||
|   void showMenu() { |   EX void showMenu() { | ||||||
|     cmode = sm::SIDE | sm::MAYDARK; |     cmode = sm::SIDE | sm::MAYDARK; | ||||||
|     gamescreen(0); |     gamescreen(0); | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								quit.cpp
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								quit.cpp
									
									
									
									
									
								
							| @@ -17,7 +17,7 @@ EX int getgametime() { | |||||||
|   return (int) (savetime + (timerstopped ? 0 : (time(NULL) - timerstart))); |   return (int) (savetime + (timerstopped ? 0 : (time(NULL) - timerstart))); | ||||||
|   } |   } | ||||||
|  |  | ||||||
| string getgametime_s(int timespent) { | EX string getgametime_s(int timespent IS(getgametime())) { | ||||||
|   char buf[20]; |   char buf[20]; | ||||||
|   sprintf(buf, "%d:%02d", timespent/60, timespent % 60); |   sprintf(buf, "%d:%02d", timespent/60, timespent % 60); | ||||||
|   return buf; |   return buf; | ||||||
|   | |||||||
							
								
								
									
										72
									
								
								tour.cpp
									
									
									
									
									
								
							
							
						
						
									
										72
									
								
								tour.cpp
									
									
									
									
									
								
							| @@ -1,24 +1,44 @@ | |||||||
| // Hyperbolic Rogue -- the Tutorial/presentation | // Hyperbolic Rogue -- the Tutorial/presentation | ||||||
| // 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 tour { | namespace hr {  | ||||||
|  |  | ||||||
| bool on; | EX namespace tour { | ||||||
|  |  | ||||||
|  | EX bool on; | ||||||
|  |  | ||||||
| bool texts = true; | bool texts = true; | ||||||
|  |  | ||||||
| string tourhelp; | EX string tourhelp; | ||||||
|  |  | ||||||
| int currentslide; | EX int currentslide; | ||||||
|  |  | ||||||
| // modes:  | #if HDR | ||||||
| //   1 - enter the slide | enum presmode {  | ||||||
| //   2 - each frame |   pmStartAll = 0, | ||||||
| //   3 - leave the slide |   pmStart = 1, pmFrame = 2, pmStop = 3, pmKey = 4, pmRestart = 5, | ||||||
| //   4 - quicken or modify the slide |   pmAfterFrame = 6, | ||||||
| //   5 - on initgame |   pmGeometry = 11, pmGeometryReset = 13, pmGeometryStart = 15 | ||||||
|  |   }; | ||||||
|  |  | ||||||
| void setCanvas(presmode mode, char canv) { | struct slide {  | ||||||
|  |   const char *name; int unused_id; int flags; const char *help;  | ||||||
|  |   function<void(presmode mode)> action; | ||||||
|  |   };   | ||||||
|  |  | ||||||
|  | static const int LEGAL_NONE=0; | ||||||
|  | static const int LEGAL_UNLIMITED=1; | ||||||
|  | static const int LEGAL_HYPERBOLIC=2; | ||||||
|  | static const int LEGAL_ANY=3; | ||||||
|  | static const int LEGAL_NONEUC=4; | ||||||
|  | static const int QUICKSKIP=8; | ||||||
|  | static const int FINALSLIDE=16; | ||||||
|  | static const int QUICKGEO=32; | ||||||
|  | static const int SIDESCREEN = 64; | ||||||
|  | static const int USE_SLIDE_NAME = 128; | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | EX void setCanvas(presmode mode, char canv) { | ||||||
|   static char wc; |   static char wc; | ||||||
|   static eLand ld; |   static eLand ld; | ||||||
|   if(mode == pmStart) { |   if(mode == pmStart) { | ||||||
| @@ -39,19 +59,19 @@ void setCanvas(presmode mode, char canv) { | |||||||
|  |  | ||||||
| bool sickmode; | bool sickmode; | ||||||
|  |  | ||||||
| function<eLand(eLand)> getNext; | EX function<eLand(eLand)> getNext; | ||||||
| function<bool(eLand)> quickfind; | EX function<bool(eLand)> quickfind; | ||||||
| function<bool(eLand)> showland; | EX function<bool(eLand)> showland; | ||||||
|  |  | ||||||
| #define GETNEXT getNext = [](eLand old) | #define GETNEXT getNext = [](eLand old) | ||||||
| #define QUICKFIND quickfind = [](eLand l) | #define QUICKFIND quickfind = [](eLand l) | ||||||
| #define SHOWLAND(f) showland = [](eLand l) { return f; } | #define SHOWLAND(f) showland = [](eLand l) { return f; } | ||||||
|  |  | ||||||
| string slidecommand; | EX string slidecommand; | ||||||
|  |  | ||||||
| hookset<void(int)> *hooks_slide; | EX hookset<void(int)> *hooks_slide; | ||||||
|  |  | ||||||
| void presentation(presmode mode) { | EX void presentation(presmode mode) { | ||||||
|  |  | ||||||
|   cheater = 0; |   cheater = 0; | ||||||
|    |    | ||||||
| @@ -68,7 +88,7 @@ void presentation(presmode mode) { | |||||||
|   callhooks(hooks_slide, mode); |   callhooks(hooks_slide, mode); | ||||||
|   } |   } | ||||||
|  |  | ||||||
| void slidehelp() { | EX void slidehelp() { | ||||||
|   if(texts && slides[currentslide].help[0]) |   if(texts && slides[currentslide].help[0]) | ||||||
|     gotoHelp( |     gotoHelp( | ||||||
|       help =  |       help =  | ||||||
| @@ -258,7 +278,7 @@ bool handleKeyTour(int sym, int uni) { | |||||||
|   return false; |   return false; | ||||||
|   } |   } | ||||||
|  |  | ||||||
| void checkGoodLand(eLand l) { | EX void checkGoodLand(eLand l) { | ||||||
|   if(!showland(l) && texts)  |   if(!showland(l) && texts)  | ||||||
|     gotoHelp(XLAT( |     gotoHelp(XLAT( | ||||||
|       "This tutorial is different than most other game tutorials -- " |       "This tutorial is different than most other game tutorials -- " | ||||||
| @@ -273,18 +293,18 @@ void checkGoodLand(eLand l) { | |||||||
|       ); |       ); | ||||||
|   } |   } | ||||||
|  |  | ||||||
| namespace ss { | EX namespace ss { | ||||||
|   vector<slide*> slideshows; |   vector<slide*> slideshows; | ||||||
|   slide *wts; |   slide *wts; | ||||||
|  |  | ||||||
|   void list(slide *ss) { |   EX void list(slide *ss) { | ||||||
|     for(auto s: slideshows) if (s == ss) return; |     for(auto s: slideshows) if (s == ss) return; | ||||||
|     slideshows.push_back(ss); |     slideshows.push_back(ss); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   string slidechars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ23456789!@#$%^&*("; |   string slidechars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ23456789!@#$%^&*("; | ||||||
|     |     | ||||||
|   void showMenu() { |   EX void showMenu() { | ||||||
|     if(!wts) wts = slides;  |     if(!wts) wts = slides;  | ||||||
|  |  | ||||||
|     dialog::init(XLAT("slides"), forecolor, 150, 100); |     dialog::init(XLAT("slides"), forecolor, 150, 100); | ||||||
| @@ -324,9 +344,9 @@ namespace ss { | |||||||
|     dialog::display(); |     dialog::display(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   } |   EX } | ||||||
|    |    | ||||||
| void start() { | EX void start() { | ||||||
|   ss::list(default_slides); |   ss::list(default_slides); | ||||||
|   currentslide = 0; |   currentslide = 0; | ||||||
|   vid.scale = 1; |   vid.scale = 1; | ||||||
| @@ -345,7 +365,7 @@ void start() { | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
| slide default_slides[] = { | EX slide default_slides[] = { | ||||||
| #if ISMOBILE | #if ISMOBILE | ||||||
|   {"Note for mobiles", 10, LEGAL_NONE | QUICKSKIP, |   {"Note for mobiles", 10, LEGAL_NONE | QUICKSKIP, | ||||||
|     "This tutorial is designed for computers, " |     "This tutorial is designed for computers, " | ||||||
| @@ -797,7 +817,7 @@ slide default_slides[] = { | |||||||
|     } |     } | ||||||
|   }; |   }; | ||||||
|  |  | ||||||
| slide *slides = default_slides; | EX slide *slides = default_slides; | ||||||
|  |  | ||||||
| auto a1 = addHook(hooks_frame, 100, [] () { if(tour::on) tour::presentation(tour::pmFrame); }); | auto a1 = addHook(hooks_frame, 100, [] () { if(tour::on) tour::presentation(tour::pmFrame); }); | ||||||
| auto a2 = addHook(hooks_handleKey, 100, handleKeyTour); | auto a2 = addHook(hooks_handleKey, 100, handleKeyTour); | ||||||
|   | |||||||
| @@ -6,10 +6,10 @@ | |||||||
|  |  | ||||||
| namespace hr { | namespace hr { | ||||||
|  |  | ||||||
| int usershape_changes; | EX int usershape_changes; | ||||||
|  |  | ||||||
| array<map<int, usershape*>, mapeditor::USERSHAPEGROUPS> usershapes; | array<map<int, usershape*>, mapeditor::USERSHAPEGROUPS> usershapes; | ||||||
| void initShape(int sg, int id) { | EX void initShape(int sg, int id) { | ||||||
|  |  | ||||||
|   if(!usershapes[sg][id]) { |   if(!usershapes[sg][id]) { | ||||||
|     usershape *us = new usershape; |     usershape *us = new usershape; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Zeno Rogue
					Zeno Rogue