mirror of
				https://github.com/zenorogue/hyperrogue.git
				synced 2025-10-30 05:23:00 +00:00 
			
		
		
		
	finalizer struct, and fixed animations breaking
This commit is contained in:
		
							
								
								
									
										6
									
								
								hyper.h
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								hyper.h
									
									
									
									
									
								
							| @@ -628,6 +628,12 @@ template<class T> struct dynamicval { | |||||||
|   ~dynamicval() { where = backup; } |   ~dynamicval() { where = backup; } | ||||||
|   }; |   }; | ||||||
|  |  | ||||||
|  | struct finalizer { | ||||||
|  |   reaction_t f; | ||||||
|  |   finalizer(reaction_t r) : f(r) {} | ||||||
|  |   ~finalizer() { f(); } | ||||||
|  |   }; | ||||||
|  |    | ||||||
| static const int MAXPLAYER = 7; | static const int MAXPLAYER = 7; | ||||||
|  |  | ||||||
| #define DEFAULTCONTROL (multi::players == 1 && !shmup::on && !multi::alwaysuse && !(rug::rugged && rug::renderonce)) | #define DEFAULTCONTROL (multi::players == 1 && !shmup::on && !multi::alwaysuse && !(rug::rugged && rug::renderonce)) | ||||||
|   | |||||||
| @@ -772,6 +772,13 @@ EX void take(string fname, const function<void()>& what IS(default_screenshot_co | |||||||
|   int multiplier = shot_aa; |   int multiplier = shot_aa; | ||||||
|   #endif |   #endif | ||||||
|    |    | ||||||
|  |   vector<bool> chg; | ||||||
|  |   for(auto ap: anims::aps) chg.push_back(*ap.value == ap.last); | ||||||
|  |   finalizer f([&] {  | ||||||
|  |     for(int i=0; i<isize(anims::aps); i++)  | ||||||
|  |       if(chg[i]) *anims::aps[i].value = anims::aps[i].last; | ||||||
|  |     }); | ||||||
|  |    | ||||||
|   dynamicval<videopar> v(vid, vid); |   dynamicval<videopar> v(vid, vid); | ||||||
|   dynamicval<bool> v2(inHighQual, true); |   dynamicval<bool> v2(inHighQual, true); | ||||||
|   dynamicval<bool> v6(auraNOGL, true); |   dynamicval<bool> v6(auraNOGL, true); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Zeno Rogue
					Zeno Rogue