aboutsummaryrefslogtreecommitdiff
path: root/games/open-invaders/skippable_intro.diff
blob: 5e21b12dfb231c843f8f2ea3d5b914918f4b0c8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
diff -Naur open-invaders-0.3/src/intro.cc open-invaders-0.3.patched/src/intro.cc
--- open-invaders-0.3/src/intro.cc	2007-11-11 04:30:53.000000000 -0500
+++ open-invaders-0.3.patched/src/intro.cc	2022-01-12 00:13:31.351070181 -0500
@@ -99,6 +99,14 @@
    "SCRLOCK",    "NUMLOCK",    "CAPSLOCK",   "MAX"
 };
 
+bool interruptible_rest(int ms) {
+	int i, count = ms / 20;
+	for(i = 0; i < count; i++) {
+		if(input_pressed()) return true;
+		rest(20);
+	}
+	return false;
+}
 
 void intro_sequence()
 {	
@@ -137,24 +145,24 @@
 		
 	clear_to_color(screen,0);
 	set_palette(black_palette);
-	rest(2000);
 	
-	alt_fade_in(jamyskis,5);
-		
 	blit(jamyskis,screen,0,0,0,0,800,600);
 		
-	rest(2000);
-	alt_fade_between(jamyskis,allegro,5);
+	if(!interruptible_rest(2000)) {
+		alt_fade_between(jamyskis,allegro,5);
 		
-	blit(allegro,screen,0,0,0,0,800,600);
+		blit(allegro,screen,0,0,0,0,800,600);
 		
-	rest(2000);
-	alt_fade_between(allegro,linuxlogo,5);
+		if(!interruptible_rest(2000)) {
+			alt_fade_between(allegro,linuxlogo,5);
 	
-	blit(linuxlogo,screen,0,0,0,0,800,600);
+			blit(linuxlogo,screen,0,0,0,0,800,600);
 	
-	rest(2000);
-	alt_fade_out(linuxlogo,5);
+			if(!interruptible_rest(2000)) {
+				alt_fade_out(linuxlogo,5);
+			}
+		}
+	}
 	
 	destroy_bitmap(jamyskis);
 	destroy_bitmap(allegro);
@@ -494,7 +502,7 @@
 								program_active=false;
 								al_pause_duh(titlesongplayer);
 								play_sample(goodbye_sound,sfx_volume,128,1000,0);
-								alt_fade_out(screen,1);			
+								alt_fade_out(screen,3);
 								title_screen_active=false;
 								break;
 						}