/[adonthell]/wastesedge/scripts/schedules/mapcharacters/extro.py
ViewVC logotype

Diff of /wastesedge/scripts/schedules/mapcharacters/extro.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.22 by ksterker, Mon Jan 27 19:53:41 2003 UTC revision 1.23 by ksterker, Mon Dec 13 08:54:35 2004 UTC
# Line 518  class extro: Line 518  class extro:
518          self.black.fillrect (0, 0, 320, 240, 0)          self.black.fillrect (0, 0, 320, 240, 0)
519          self.black.thisown = 0          self.black.thisown = 0
520          self.black.pack ()          self.black.pack ()
   
         self.target = adonthell.win_image ()  
         self.target.resize (320, 240)  
         self.target.thisown = 0  
         self.target.pack ()  
521                    
522          # -- label          # -- label
523          self.label = adonthell.win_label ()          self.label = adonthell.win_label ()
# Line 539  class extro: Line 534  class extro:
534          self.window.set_visible_border (0)          self.window.set_visible_border (0)
535          self.window.set_trans_background (1)          self.window.set_trans_background (1)
536                    
         self.window.add (self.target)  
537          self.window.add (self.black)          self.window.add (self.black)
538          self.window.add (self.label)          self.window.add (self.label)
539                    
540          self.window.set_activate (1)          self.window.set_activate (1)
541          self.window.set_visible_all (1)          self.window.set_visible_all (1)
542                    
         self.window.py_signal_connect (self.on_draw, adonthell.win_event_UPDATE)  
           
         self.draw_func = self.forest_animation  
           
543          # -- audio          # -- audio
544          adonthell.audio_fade_out_background (500)          adonthell.audio_fade_out_background (500)
545                    
546          # -- misc stuff          # -- misc stuff
547          self.step = 0       # -- for the extro control          self.step = 0       # -- for the extro control
548          self.anim = 0       # -- for the forest animation control          self.a1 = 0
549            self.a2 = 0
550            self.a3 = 0         # -- for the forest animation control
551          self.index = 0      # -- index in the typeover array          self.index = 0      # -- index in the typeover array
552          self.delay = 0      # -- delay before adding new text          self.delay = 0      # -- delay before adding new text
553          self.cursor = 0     # -- cursor in the typeover text          self.cursor = 0     # -- cursor in the typeover text
554          self.x = [0, 0, 0]  # -- offsets of the 3 forest pics          self.x = [0, 0, 0]  # -- offsets of the 3 forest pics and Alek
555    
556            adonthell.gamedata_engine ().set_update_map (0)
557            self.letsexit = 0
558            
559            adonthell.gametime_update ()
560            while self.letsexit != 1:
561                for i in range (0, adonthell.gametime_frames_to_skip ()):
562                     self.forest_animation ()
563                     self.alek_run.update ()
564                     self.window.update ()
565                     adonthell.gametime_update ()
566                
567                if self.letsexit != 1:
568                    self.window.draw ()
569                    adonthell.screen_show ()
570            
571          adonthell.gamedata_engine ().main (self.window, 'fmv')          adonthell.gamedata_engine ().main (self.window, 'fmv')
572                    
573          # -- quit!          # -- quit!
# Line 569  class extro: Line 576  class extro:
576                    
577      def forest_animation (self):      def forest_animation (self):
578          # -- animate          # -- animate
579          update = 0          if self.a1 >= 4:
580          self.anim = self.anim + 1              self.x[0] = self.update_wood (self.wood1, self.x[0])
581          if self.anim % 2 == 0:              self.a1 = 0
582              update = 1          else: self.a1 = self.a1 + 1
             self.alek_run.update ()  
             self.x[2] = self.update_wood (self.wood3, self.x[2])  
   
             if self.anim % 4 == 0:  
                 self.x[0] = self.update_wood (self.wood1, self.x[0])  
583    
584                    # Magic number
585          if self.anim % 3 == 0:          if self.a2 >= 2:
             update = 1  
586              self.x[1] = self.update_wood (self.wood2, self.x[1])              self.x[1] = self.update_wood (self.wood2, self.x[1])
587                        self.a2 = 0
588            else: self.a2 = self.a2 + 1
589    
590            # Magic number
591            if self.a3 >= 1:
592                self.x[2] = self.update_wood (self.wood3, self.x[2])
593                self.a3 = 0
594            else: self.a3 = self.a3 + 1
595    
596          # -- draw          # -- draw
597          if update == 1:          self.draw_wood (self.wood1, self.x[0])
598              self.draw_wood (self.wood1, self.x[0])          self.draw_wood (self.wood2, self.x[1])
599              self.draw_wood (self.wood2, self.x[1])          self.alek_run.draw (110, 120, self.da)
600              self.alek_run.draw (110, 120, self.da, self.target)          self.draw_wood (self.wood3, self.x[2])
             self.draw_wood (self.wood3, self.x[2])  
601                    
602          # -- fade in          # -- fade in
603          if self.step == 0:          if self.step == 0:
604              alpha = self.black.alpha ()              alpha = self.black.alpha () - 2
605              if alpha != 0:              if alpha >= 0:
606                  self.black.set_alpha (alpha - 1)                  self.black.set_alpha (alpha)
607                  return                  return
608              else:              else:
609                  adonthell.audio_load_background (2, "audio/at-demo-2.ogg")                  adonthell.audio_load_background (2, "audio/at-demo-2.ogg")
# Line 604  class extro: Line 612  class extro:
612                  self.window.remove (self.black)                  self.window.remove (self.black)
613                  self.step = 1                  self.step = 1
614                    
615            # Alek running ...
616          elif self.step == 1:          elif self.step == 1:
617              if self.index < len (self.typeover):              if self.index < len (self.typeover):
618                  if self.cursor < len (self.typeover[self.index]):                  if self.cursor < len (self.typeover[self.index]):
619                      self.delay = self.delay + 1                      self.delay = self.delay + 2.8
620                                            
621                      if self.delay >= 6:                      if self.delay >= 6:
622                          if self.cursor == 0: self.label.set_text ("")                          if self.cursor == 0: self.label.set_text ("")
# Line 625  class extro: Line 634  class extro:
634              else:              else:
635                  self.delay = 0                  self.delay = 0
636                  self.step = 2                  self.step = 2
637                            
638          # -- wait some more          # -- wait some more
639          elif self.step == 2:          elif self.step == 2:
640              self.delay = self.delay + 1              self.delay = self.delay + 3
641              if self.delay == 350:              if self.delay >= 300:
642                    # -- audio                    # -- audio
643                    adonthell.audio_fade_out_background (2000)                    adonthell.audio_fade_out_background (2000)
644                    self.window.add (self.black)                    self.window.add (self.black)
# Line 637  class extro: Line 646  class extro:
646                    
647          # -- fade out          # -- fade out
648          elif self.step == 3:          elif self.step == 3:
649              alpha = self.black.alpha ()              alpha = self.black.alpha () + 2
650              if alpha != 255:              if alpha <= 255:
651                  self.black.set_alpha (alpha + 1)                  self.black.set_alpha (alpha)
652                  return                  return
653              else:              else:
654                    self.letsexit = 1
655    
656                  self.draw_func = self.scroll_credits                  self.draw_func = self.scroll_credits
657                  adonthell.win_manager_get_active ().remove (self.window)                  self.window = self.make_credits ()
658                  del self.window                  self.window.py_signal_connect (self.on_draw, adonthell.win_event_UPDATE)
659                  adonthell.win_manager_get_active ().add (self.make_credits ())                          adonthell.win_manager_get_active ().add (self.window)        
660            
661      # -- update the forest position      # -- update the forest position
662      def update_wood (self, pic, x):      def update_wood (self, pic, x):
663          if x >= pic.length (): x = x - pic.length ()          if x >= adonthell.screen_length (): x = x - pic.length ()
664          else: x = x + 1          else: x = x + 1
665          return x          return x
666    
667      # -- draw the forest      # -- draw the forest
668      def draw_wood (self, pic, x):      def draw_wood (self, pic, x):
669          pic.draw (x - pic.length (), 0, self.da, self.target)          pic.draw (x, 0, self.da)
670          if x < adonthell.screen_length ():          if x > 0:
671              pic.draw (x, 0, self.da, self.target)              pic.draw (x - pic.length (), 0, self.da)
672    
673      # -- prepare credits      # -- prepare credits
674      def make_credits (self):      def make_credits (self):

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.23

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26