slackbuilds_ponce/games/open-invaders/skippable_intro.diff
B. Watson 89c4e960be
games/open-invaders: Added (game similar to space invaders)
Signed-off-by: bedlam <dave@slackbuilds.org>

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
2023-01-28 08:22:57 +07:00

63 lines
1.5 KiB
Diff

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;
}