mirror of
				https://github.com/zenorogue/hyperrogue.git
				synced 2025-10-31 05:52:59 +00:00 
			
		
		
		
	altmap relspin is now remembered in altmap::relspin
This commit is contained in:
		
							
								
								
									
										47
									
								
								bigstuff.cpp
									
									
									
									
									
								
							
							
						
						
									
										47
									
								
								bigstuff.cpp
									
									
									
									
									
								
							| @@ -150,6 +150,27 @@ EX int default_levs() { | |||||||
|   return S3-3; |   return S3-3; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  | #if HDR | ||||||
|  | namespace altmap { | ||||||
|  |   /** h->move(relspin(h->alt)) corresponds to h->alt->move(0) */ | ||||||
|  |   inline short& relspin(heptagon *alt) { return alt->zebraval; } | ||||||
|  |  | ||||||
|  |   /** in product geometries: the height of the center; call on alt->alt */ | ||||||
|  |   int hybrid_height(heptagon *alt) { return alt->fieldval; } | ||||||
|  |   void set_hybrid_height(heptagon *alt, int z) { alt->fieldval = z; } | ||||||
|  |  | ||||||
|  |   /** for Camelot, the radius */ | ||||||
|  |   short& radius(heptagon *alt) { return alt->emeraldval; } | ||||||
|  |  | ||||||
|  |   /** type of the horocycle -- currently used in Land of Storms which has two types */ | ||||||
|  |   short& which(heptagon *alt) { return alt->emeraldval; } | ||||||
|  |  | ||||||
|  |   /** the original land, for altmaps which may appear in multiple lands (Camelot) */ | ||||||
|  |   short& orig_land(heptagon *alt) { return alt->fiftyval; } | ||||||
|  | >>>>>>> f8161a9a (altmap::relspin for C++11) | ||||||
|  |   } | ||||||
|  | #endif | ||||||
|  |  | ||||||
| void hrmap::generateAlts(heptagon *h, int levs, bool link_cdata) { | void hrmap::generateAlts(heptagon *h, int levs, bool link_cdata) { | ||||||
|   if(hybri) { PIU ( generateAlts(h, levs, link_cdata) ); } |   if(hybri) { PIU ( generateAlts(h, levs, link_cdata) ); } | ||||||
|   if(!h->alt) return; |   if(!h->alt) return; | ||||||
| @@ -159,28 +180,9 @@ void hrmap::generateAlts(heptagon *h, int levs, bool link_cdata) { | |||||||
|     for(int i=0; i<S7; i++) preventbarriers(createStep(h, i)->c7); |     for(int i=0; i<S7; i++) preventbarriers(createStep(h, i)->c7); | ||||||
|   for(int i=0; i<h->type; i++)  |   for(int i=0; i<h->type; i++)  | ||||||
|     createStep(h->alt, i)->alt = h->alt->alt; |     createStep(h->alt, i)->alt = h->alt->alt; | ||||||
|   int relspin = -4; // for horocycles it must go the other way |      | ||||||
|   if(quotient) relspin = 0; |   auto relspin = altmap::relspin(h->alt); | ||||||
|   #if MAXMDIM >= 4 |  | ||||||
|   else if(reg3::in_rule()) relspin = 0; |  | ||||||
|   #endif |  | ||||||
|   else { |  | ||||||
|   for(int j=0; j<h->type; j++) for(int i=0; i<h->type; i++) { |  | ||||||
|     createStep(h, i); |  | ||||||
|     if(h->move(i)->alt == h->alt->move(j)) { |  | ||||||
|       relspin = (i-j+S7) % S7; |  | ||||||
|       break; |  | ||||||
|       } |  | ||||||
|     } |  | ||||||
|   if(relspin == -4 && geometry != gFieldQuotient) { |  | ||||||
|     if(h->alt != h->alt->alt) { |  | ||||||
|       printf("relspin {%p:%p}\n", hr::voidp(h->alt), hr::voidp(h->alt->alt)); |  | ||||||
|       {for(int i=0; i<S7; i++) printf("%p ", hr::voidp(h->alt->move(i)));} printf(" ALT\n"); |  | ||||||
|       {for(int i=0; i<S7; i++) printf("%p ", hr::voidp(h->move(i)));} printf(" REAL\n"); |  | ||||||
|       {for(int i=0; i<S7; i++) printf("%p ", hr::voidp(h->move(i)->alt));} printf(" REAL ALT\n"); |  | ||||||
|       } |  | ||||||
|     relspin = 3; |  | ||||||
|     } } |  | ||||||
|   // h[relspin] matches alt[0] |   // h[relspin] matches alt[0] | ||||||
| //printf("{%d~%d}\n", h->distance, h->alt->distance); | //printf("{%d~%d}\n", h->distance, h->alt->distance); | ||||||
|   if(h->type != h->alt->type) return; |   if(h->type != h->alt->type) return; | ||||||
| @@ -199,6 +201,7 @@ void hrmap::generateAlts(heptagon *h, int levs, bool link_cdata) { | |||||||
|       continue; |       continue; | ||||||
|       } |       } | ||||||
|     ho->alt = hm; |     ho->alt = hm; | ||||||
|  |     altmap::relspin(hm) = gmod(h->c.spin(i) - h->alt->c.spin(ir), hm->type); | ||||||
|     if(link_cdata) hm->cdata = (cdata*) ho; |     if(link_cdata) hm->cdata = (cdata*) ho; | ||||||
|     if(levs) currentmap->generateAlts(ho, levs-1, link_cdata); |     if(levs) currentmap->generateAlts(ho, levs-1, link_cdata); | ||||||
|     if(S3 >= OINF) preventbarriers(ho->c7); |     if(S3 >= OINF) preventbarriers(ho->c7); | ||||||
|   | |||||||
							
								
								
									
										6
									
								
								cell.cpp
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								cell.cpp
									
									
									
									
									
								
							| @@ -94,6 +94,7 @@ struct hrmap_standard : hrmap { | |||||||
|   virtual int shvid(cell *c) override; |   virtual int shvid(cell *c) override; | ||||||
|   virtual hyperpoint get_corner(cell *c, int cid, ld cf) override; |   virtual hyperpoint get_corner(cell *c, int cid, ld cf) override; | ||||||
|   virtual transmatrix master_relative(cell *c, bool get_inverse) override; |   virtual transmatrix master_relative(cell *c, bool get_inverse) override; | ||||||
|  |   virtual bool link_alt(heptagon *h, heptagon *alt, hstate firststate, int dir) override; | ||||||
|   }; |   }; | ||||||
|  |  | ||||||
| void clearfrom(heptagon*); | void clearfrom(heptagon*); | ||||||
| @@ -132,6 +133,11 @@ bool hrmap::link_alt(heptagon *h, heptagon *alt, hstate firststate, int dir) { | |||||||
|   return true;  |   return true;  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  | bool hrmap_standard::link_alt(heptagon *h, heptagon *alt, hstate firststate, int dir) { | ||||||
|  |   altmap::relspin(alt) = 3; | ||||||
|  |   return true; | ||||||
|  |   } | ||||||
|  |  | ||||||
| void hrmap::virtualRebase(heptagon*& base, transmatrix& at) { | void hrmap::virtualRebase(heptagon*& base, transmatrix& at) { | ||||||
|   printf("virtualRebase called unexpectedly\n");  |   printf("virtualRebase called unexpectedly\n");  | ||||||
|   return; |   return; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Zeno Rogue
					Zeno Rogue