mirror of
				https://github.com/zenorogue/hyperrogue.git
				synced 2025-10-31 05:52:59 +00:00 
			
		
		
		
	racing:: limit on pauses
This commit is contained in:
		
							
								
								
									
										18
									
								
								racing.cpp
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								racing.cpp
									
									
									
									
									
								
							| @@ -1250,8 +1250,26 @@ EX void displayScore(eLand l) { | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  | EX int pause_limit = 3; | ||||||
|  |  | ||||||
|  | EX bool started() { | ||||||
|  |   return race_start_tick && ticks >= race_start_tick; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  | EX bool finished() { | ||||||
|  |   for(int& i: racing::race_finish_tick) if(!i) return false; | ||||||
|  |   return true; | ||||||
|  |   } | ||||||
|  |  | ||||||
| EX void race_won() { | EX void race_won() { | ||||||
|   if(!race_finish_tick[multi::cpid]) { |   if(!race_finish_tick[multi::cpid]) { | ||||||
|  |  | ||||||
|  |     if(shmup::count_pauses >= pause_limit) { | ||||||
|  |       addMessage(XLAT("Too many pauses!")); | ||||||
|  |       race_finish_tick[multi::cpid] = ticks; | ||||||
|  |       return; | ||||||
|  |       } | ||||||
|  |  | ||||||
|     int result = ticks - race_start_tick; |     int result = ticks - race_start_tick; | ||||||
|     int losers = 0; |     int losers = 0; | ||||||
|     int place = 1; |     int place = 1; | ||||||
|   | |||||||
							
								
								
									
										15
									
								
								shmup.cpp
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								shmup.cpp
									
									
									
									
									
								
							| @@ -851,10 +851,10 @@ void movePlayer(monster *m, int delta) { | |||||||
|       mdx = mdy = 0; |       mdx = mdy = 0; | ||||||
|       } |       } | ||||||
|     facemouse = shotkey = dropgreen = false; |     facemouse = shotkey = dropgreen = false; | ||||||
|     if(ticks < racing::race_start_tick || !racing::race_start_tick) (WDIM == 2 ? mgo : mdy) = 0; |     if(!racing::started()) (WDIM == 2 ? mgo : mdy) = 0; | ||||||
|     } |     } | ||||||
|   else { |   else { | ||||||
|     if(racing::on && (ticks < racing::race_start_tick || !racing::race_start_tick)) mgo = mdx = mdy = 0; |     if(racing::on && !racing::started()) mgo = mdx = mdy = 0; | ||||||
|     } |     } | ||||||
|   #endif |   #endif | ||||||
|    |    | ||||||
| @@ -2564,6 +2564,9 @@ EX hookset<bool(int)> hooks_turn; | |||||||
| /** the amount of time chars are disabled in PvP */ | /** the amount of time chars are disabled in PvP */ | ||||||
| EX int pvp_delay = 2000; | EX int pvp_delay = 2000; | ||||||
|  |  | ||||||
|  | EX int count_pauses; | ||||||
|  | EX bool in_pause; | ||||||
|  |  | ||||||
| EX void turn(int delta) { | EX void turn(int delta) { | ||||||
|  |  | ||||||
|   if(split_screen && subscreens::split( [delta] () { turn(delta); })) return; |   if(split_screen && subscreens::split( [delta] () { turn(delta); })) return; | ||||||
| @@ -2592,6 +2595,13 @@ EX void turn(int delta) { | |||||||
|   if(!shmup::on) return;   |   if(!shmup::on) return;   | ||||||
|   if(!(cmode & sm::NORMAL)) { |   if(!(cmode & sm::NORMAL)) { | ||||||
|     #if CAP_RACING |     #if CAP_RACING | ||||||
|  |     if(!in_pause) { | ||||||
|  |       in_pause = true; | ||||||
|  |       if(!(racing::on && !racing::started() && !racing::finished())) { | ||||||
|  |         count_pauses++; | ||||||
|  |         addMessage(XLAT("Pauses: %1 of %2 allowed", its(count_pauses), its(racing::pause_limit))); | ||||||
|  |         } | ||||||
|  |       } | ||||||
|     if(racing::on) { |     if(racing::on) { | ||||||
|       if(racing::race_start_tick) racing::race_start_tick += delta; |       if(racing::race_start_tick) racing::race_start_tick += delta; | ||||||
|       for(int& i: racing::race_finish_tick) if(i) i += delta; |       for(int& i: racing::race_finish_tick) if(i) i += delta; | ||||||
| @@ -2599,6 +2609,7 @@ EX void turn(int delta) { | |||||||
|     #endif |     #endif | ||||||
|     return; |     return; | ||||||
|     } |     } | ||||||
|  |   else in_pause = false; | ||||||
|  |  | ||||||
|   passive_switch = (gold() & 1) ? moSwitch1 : moSwitch2; |   passive_switch = (gold() & 1) ? moSwitch1 : moSwitch2; | ||||||
|    |    | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Zeno Rogue
					Zeno Rogue