adonthell-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[adonthell-wastesedge-commits] remove_sdl1_2 26039dc 28/29: ADDED abilit


From: Kai Sterker
Subject: [adonthell-wastesedge-commits] remove_sdl1_2 26039dc 28/29: ADDED abilitiy to skip forest sequence and credits
Date: Mon, 25 Jul 2016 18:16:09 +0000 (UTC)

tag: remove_sdl1_2
commit 26039dc7711dcf885d82724116b82780a5afb57e
Author: Kai Sterker <address@hidden>
Commit: Kai Sterker <address@hidden>

    ADDED abilitiy to skip forest sequence and credits
---
 scripts/schedules/mapcharacters/extro.py |   34 ++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/scripts/schedules/mapcharacters/extro.py 
b/scripts/schedules/mapcharacters/extro.py
index 763b4d8..71080cf 100644
--- a/scripts/schedules/mapcharacters/extro.py
+++ b/scripts/schedules/mapcharacters/extro.py
@@ -212,6 +212,8 @@ class extro(object):
         self.bjarn.load_raw ('gfx/cutscene/extro_bjarn.img')
         self.bjarn.pack ()
         self.bjarn.thisown = 0
+        
+        self.skipping = False
 
         # -- set new audio schedule and play extro music
         adonthell.audio_load_background (0, "audio/at-demo-9.ogg")
@@ -558,6 +560,8 @@ class extro(object):
         
         adonthell.gametime_update ()
         while self.letsexit != 1:
+            adonthell.input_update ()
+            
             for i in range (0, adonthell.gametime_frames_to_skip ()):
                  self.forest_animation ()
                  if self.a3 == 1:
@@ -576,6 +580,24 @@ class extro(object):
         adonthell.gamedata_engine ().main_quit ()
         
     def forest_animation (self):
+        # -- allow skipping forest animation
+        if adonthell.input_has_been_pushed (adonthell.SDLK_ESCAPE) or \
+           adonthell.input_has_been_pushed (adonthell.SDLK_SPACE) and \
+           self.skipping == False:
+            self.skipping = True
+            adonthell.audio_fade_out_background (2000)
+            self.window.add (self.black)
+        
+        # -- gently fade out forest if skipping
+        if self.skipping:
+            alpha = self.black.alpha () + 2
+            if alpha <= 255:
+                self.black.set_alpha (alpha)
+                return
+            else:
+                self.step = 3
+                self.skipping = False
+        
         # -- animate
         if self.a1 >= 4:
             self.x[0] = self.update_wood (self.wood1, self.x[0])
@@ -726,6 +748,18 @@ class extro(object):
         self.anim = self.anim + 1
         if self.anim % 3 != 0: return
 
+        # -- allow skipping credits
+        if (adonthell.input_has_been_pushed (adonthell.SDLK_ESCAPE) or \
+            adonthell.input_has_been_pushed (adonthell.SDLK_SPACE)) and \
+            self.skipping == False:
+                adonthell.audio_fade_out_background (2000)
+                self.skipping = True
+
+        # -- gently fade out music when skipping, then quit
+        if self.skipping and adonthell.audio_is_background_finished():
+             adonthell.gamedata_engine ().main_quit ()
+             return
+                   
         if self.step == 0:
             idx = 0
         



reply via email to

[Prev in Thread] Current Thread [Next in Thread]