ó
Ä‚Œ\c           @  så   d  d l  m Z d  d l Z d  d l Z d  d l Z d  d l Z d e f d „  ƒ  YZ d e f d „  ƒ  YZ	 d e j
 j j f d „  ƒ  YZ d	 „  Z d
 e j
 j j f d „  ƒ  YZ d e j
 j j f d „  ƒ  YZ d e d „ Z d S(   iÿÿÿÿ(   t   print_functionNt   Statec           B  s2   e  Z d  Z d „  Z d „  Z d „  Z d „  Z RS(   sA   
    This creates a state that can be used in a SMAnimation.
    c         O  s\   | r4 t  | t j j j ƒ r4 t j j | ƒ } n  | |  _ | |  _ | |  _	 | |  _
 d S(   sä  
        @param name: A string giving the name of this state.

        @param image: The displayable that is shown to the user while
        we are in (entering) this state. For convenience, this can
        also be a string or tuple, which is interpreted with Image.

        image should be None when this State is used with motion,
        to indicate that the image will be replaced with the child of
        the motion.

        @param atlist: A list of functions to call on the image. (In
        general, if something can be used in an at clause, it can be
        used here as well.)

        If any keyword arguments are given, they are used to construct a
        Position object, that modifies the position of the image.
        N(   t
   isinstancet   renpyt   displayt   coret   Displayablet   easyt   displayablet   namet   imaget   atlistt
   properties(   t   selfR	   R
   R   R   (    (    sk   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\anim.pyt   __init__&   s    			c         C  s   |  | j  |  j <d  S(   N(   t   statesR	   (   R   t   sma(    (    sk   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\anim.pyt   addB   s    c         C  sT   |  j  } x |  j D] } | | ƒ } q W|  j rP t j j j | |  j  } n  | S(   N(   R
   R   R   R   R   t   layoutt   Position(   R   t   rvt   i(    (    sk   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\anim.pyt	   get_imageE   s    		c         C  s1   |  j  d  k	 r |  j  } n  t |  j | |  j Œ S(   N(   R
   t   NoneR   R	   R   (   R   t   child(    (    sk   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\anim.pyt   motion_copyP   s    (   t   __name__t
   __module__t   __doc__R   R   R   R   (    (    (    sk   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\anim.pyR   !   s
   			t   Edgec           B  s&   e  Z d  Z d d d „ Z d „  Z RS(   sC   
    This creates an edge that can be used with a SMAnimation.
    i   c         C  s1   | |  _  | |  _ | |  _ | |  _ | |  _ d S(   s¥  
        @param old: The name (a string) of the state that this transition is from.

        @param delay: The number of seconds that this transition takes.

        @param new: The name (a string) of the state that this transition is to.

        @param trans: The transition that will be used to show the
        image found in the new state. If None, the image is show
        immediately.

        When used with an SMMotion, the transition should probably be
        move.

        @param prob: The number of times this edge is added. This can
        be used to make a transition more probable then others. For
        example, if one transition out of a state has prob=5, and the
        other has prob=1, then the one with prob=5 will execute 5/6 of
        the time, while the one with prob=1 will only occur 1/6 of the
        time. (Don't make this too large, as memory use is proportional to
        this value.)
        N(   t   oldt   delayt   newt   transt   prob(   R   R   R   R    R!   R"   (    (    sk   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\anim.pyR   ]   s
    				c         C  s@   x9 t  d |  j ƒ D]% } | j j |  j g  ƒ j |  ƒ q Wd  S(   Ni    (   t   xrangeR"   t   edgest
   setdefaultR   t   append(   R   R   t   _i(    (    sk   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\anim.pyR   {   s    N(   R   R   R   R   R   R   (    (    (    sk   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\anim.pyR   X   s   t   SMAnimationc           B  sV   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d d d d „ Z
 RS(	   s¿  
    This creates a state-machine animation. Such an animation is
    created by randomly traversing the edges between states in a
    defined state machine. Each state corresponds to an image shown to
    the user, with the edges corresponding to the amount of time an
    image is shown, and the transition it is shown with.

    Images are shown, perhaps with a transition, when we are
    transitioning into a state containing that image.
    c         O  s  d | k r# | d |  _  | d =n	 d |  _  d | k rO | d |  _ | d =n	 t |  _ d | k r{ | d |  _ | d =n	 t |  _ t t |  ƒ j |   | |  _	 | |  _
 i  |  _ i  |  _ x | D] } | j |  ƒ qÅ Wd |  _ d |  _ d |  _ d |  _ d S(   s  
        @param initial: The name (a string) of the initial state we
        start in.

        @param showold: If the keyword parameter showold is True, then
        the old image is shown instead of the new image when in an
        edge.

        @param anim_timebase: If True, we use the animation
        timebase. If False, we use the displayable timebase.

        This accepts as additional arguments the anim.State and
        anim.Edge objects that are used to make up this state
        machine.
        R   t   showoldt   anim_timebaseN(   R   R   R)   t   FalseR*   t   Truet   superR(   R   R   t   initialR   R$   R   t
   edge_startt
   edge_cachet   edget   state(   R   R.   t   argsR   R   (    (    sk   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\anim.pyR   Œ   s.    
	
	
								c         C  s#   g  |  j  j ƒ  D] } | j ^ q S(   N(   R   t
   itervaluesR
   (   R   R   (    (    sk   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\anim.pyt   visitÌ   s    c         C  sN   | |  j  k r d |  _ d S|  j  | } t j | ƒ |  _ |  j j |  _ d S(   s  
        This randomly picks an edge out of the given state, if
        one exists. It updates self.edge if a transition has
        been selected, or returns None if none can be found. It also
        updates self.image to be the new image on the selected edge.
        N(   R$   R   R1   t   randomt   choiceR    R2   (   R   R2   R$   (    (    sk   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\anim.pyt	   pick_edgeÏ   s    	c         C  s›   |  j  j rP |  j  j d |  j |  j  j j ƒ  d |  j |  j  j j ƒ  ƒ } n> |  j ru |  j |  j  j j ƒ  } n |  j |  j  j j ƒ  } | |  _ d S(   s×   
        Places the correct Displayable into the edge cache, based on
        what is contained in the given edge. This takes into account
        the old and new states, and any transition that is present.
        t
   old_widgett
   new_widgetN(   R1   R!   R   R   R   R    R)   R0   (   R   t   im(    (    sk   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\anim.pyt   update_cacheß   s    %	c         C  sL   |  j  r |  j  j ƒ  S|  j r9 |  j |  j j ƒ  j ƒ  St t |  ƒ j ƒ  S(   N(   R0   t   get_placementR2   R   R   R-   R(   (   R   (    (    sk   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\anim.pyR=   ð   s
    		c   
      C  s±  |  j  r | } n | } |  j d  k s6 | |  j k  r[ | |  _ d  |  _ |  j |  j ƒ n  xW |  j r´ | |  j |  j j k r´ |  j |  j j 7_ d  |  _ |  j |  j j ƒ q^ W|  j sù t	 j
 j j |  j |  j j ƒ  | | | |  j | ƒ } nz |  j s|  j ƒ  n  t	 j
 j j |  j | | | |  j | ƒ } t	 j j sst	 j
 j j |  j |  j j | |  j ƒ n  | j ƒ  \ } } t	 j
 j j | | ƒ }	 |	 j | d ƒ |	 S(   Ni    (   i    i    (   R*   R/   R   R0   R8   R.   R1   R   R    R   R   t   renderR   R2   R   R<   t   gamet   less_updatest   redrawt   get_sizet   Rendert   blit(
   R   t   widtht   heightt   stt   att   tR;   t   iwt   ihR   (    (    sk   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\anim.pyR>   ú   s0    				%			+-c         C  s‘   | d k r | } n  g  } x- |  j j ƒ  D] } | j | j | ƒ ƒ q+ Wx$ |  j j ƒ  D] } | j | ƒ q[ Wt |  j d |  j	 | |  j
 ŽS(   së   
        Used when this SMAnimation is used as a SMMotion. This creates
        a duplicate of the animation, with all states containing None
        as the image having that None replaced with the image that is provided here.
        R   N(   R   R   R4   R&   R   R$   t   extendR(   R.   R   R   (   R   R   R:   R9   R3   R2   R$   (    (    sk   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\anim.pyt   __call__%  s    	N(   R   R   R   R   R5   R8   R<   R=   R>   R   RM   (    (    (    sk   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\anim.pyR(   €   s   
	@				
	+c          O  s]   g  } xG t  |  ƒ D]9 \ } } | j | ƒ | d d k r | j d  ƒ q q Wt | | Ž  S(   Ni   i   (   t	   enumerateR&   R   t   TransitionAnimation(   R3   t   kwargst   newargsR   t   a(    (    sk   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\anim.pyt	   Animationw  s    RO   c           B  s)   e  Z d  Z d „  Z d „  Z d „  Z RS(   s^   
    A displayable that draws an animation with each frame separated
    by a transition.
    c         O  sY  | j  d d ƒ | j d t ƒ |  _ t t |  ƒ j |   g  } g  } g  } xs t | ƒ D]e \ } } | d d k r’ | j t	 j
 j | ƒ ƒ qZ | d d k r² | j | ƒ qZ | j | ƒ qZ Wt | ƒ t | ƒ k rë | j d ƒ n  t | ƒ t | ƒ k r| j d
 ƒ n  | |  _ | d	 g | d	  |  _ | |  _ | d	 g | d	  |  _ d
 S(   sq  
        This takes arguments such that the 1st, 4th, 7th, ...
        arguments are displayables, the 2nd, 5th, 8th, ... on arguments
        are times, and the 3rd, 6th, 9th, ... are transitions.

        This displays the first displayable for the given time, then
        transitions to the second displayable using the given
        transition, and shows it for the given time (the time of the
        transition is taken out of the time the frame is shown), and
        so on.

        The last argument may be a displayable (in which case that
        displayable is used to transition back to the first frame), or
        a displayable (which is shown forever).

        There is one keyword argument, apart from the style properties:

        @param anim_timebase: If True, the default, use the animation
        timebase. Otherwise, use the displayable timebase.
        t   stylet	   animationR*   i   i    i   g     Ôv@g     õ@iÿÿÿÿNg    ~~A(   R%   t   popR,   R*   R-   RO   R   RN   R&   R   R   R   t   lenR   t   imagest   prev_imagest   delayst   transitions(   R   R3   R   RX   RZ   R[   R   t   arg(    (    sk   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\anim.pyR   ˆ  s(    		c         C  s6  |  j  r | } n | } | t |  j ƒ } xt |  j |  j |  j |  j ƒ D]á \ } } }	 }
 | |	 k  r$t j j	 s” t j
 j j |  |	 | ƒ n  |
 rÅ | |  j d k rÅ |
 d | d | ƒ } n  t j
 j j | | | | | ƒ } | j ƒ  \ } } t j
 j j | | ƒ } | j | d ƒ | S| |	 } qM Wd  S(   Ni    R9   R:   (   i    i    (   R*   t   sumRZ   t   zipRX   RY   R[   R   R?   R@   R   R>   RA   RB   RC   RD   (   R   RE   RF   RG   RH   t   orig_tRI   R
   t   prevR   R!   R;   R   (    (    sk   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\anim.pyR>   º  s     		4!c         C  s   |  j  S(   N(   RX   (   R   (    (    sk   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\anim.pyR5   Õ  s    (   R   R   R   R   R>   R5   (    (    (    sk   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\anim.pyRO   ‚  s   	2	t   Blinkc        	   B  sA   e  Z d  Z d d d d d d d e d „ Z d „  Z d „  Z RS(   s   
    g      à?g      ð?g        c
         K  sŒ   t  t |  ƒ j |
   t j j | ƒ |  _ | |  _ | |  _ | |  _	 | |  _
 | |  _ | |  _ | |  _ |	 |  _ | | | | |  _ d S(   sÃ  
        This takes as an argument an image or widget, and blinks that image
        by varying its alpha. The sequence of phases is
        on - set - off - rise - on - ... All times are given in seconds, all
        alphas are fractions between 0 and 1.

        @param image: The image or widget that will be blinked.

        @param on: The amount of time the widget spends on, at high alpha.

        @param off: The amount of time the widget spends off, at low alpha.

        @param rise: The amount time the widget takes to ramp from low to high alpha.

        @param set: The amount of time the widget takes to ram from high to low.

        @param high: The high alpha.

        @param low: The low alpha.

        @param offset: A time offset, in seconds. Use this to have a
        blink that does not start at the start of the on phase.

        @param anim_timebase: If True, use the animation timebase, if false, the displayable timebase.
        N(   R-   Ra   R   R   R   R   R
   t   ont   offt   riset   sett   hight   lowt   offsetR*   t   cycle(   R   R
   Rb   Rc   Rd   Re   Rf   Rg   Rh   R*   R   (    (    sk   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\anim.pyR   Ý  s    								c         C  s
   |  j  g S(   N(   R
   (   R   (    (    sk   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\anim.pyR5     s    c         C  sþ  |  j  r | } n | } |  j | |  j } |  j } d | k oO |  j k  n rm |  j | } |  j } n  | |  j 8} d | k o” |  j k  n rË d } | |  j }	 |  j |	 |  j d |	 } n  | |  j 8} d | k oò |  j k  n r|  j | } |  j } n  | |  j 8} d | k o7|  j k  n rnd } | |  j }	 |  j |	 |  j d |	 } n  t	 j
 j j |  j | | | | ƒ }
 |
 j ƒ  \ } } t	 j
 j j | | ƒ } | j |
 d ƒ | | _ t	 j j sút	 j
 j j |  | ƒ n  | S(   Ni    g      ð?(   i    i    (   R*   Rh   Ri   Rf   Rb   Re   Rg   Rc   Rd   R   R   R>   R
   RB   RC   RD   t   alphaR?   R@   RA   (   R   RF   RE   RG   RH   RI   t   timeRj   R   t   fract   rendt   wt   hR   (    (    sk   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\anim.pyR>   
  s<    			$	(   R   R   R   R+   R   R5   R>   (    (    (    sk   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\anim.pyRa   Ù  s
   )	c      	   K  s  | \ } } | \ }	 }
 | d k r1 |	 |
 } n  d } g  } x¤ t d |
 ƒ D]“ } xz t d |	 ƒ D]i } | | } | | } | j t j j j |  | | | | ƒ ƒ | j | ƒ | d 7} | | k rc Pqc qc W| | k rM PqM qM W| s÷ | j ƒ  n  t | | Ž  S(   sÕ  
    This creates an animation from a single image. This image
    must consist of a grid of frames, with the number of columns and
    rows in the grid being taken from gridsize, and the size of each
    frame in the grid being taken from framesize. This takes frames
    and sticks them into an Animation, with the given delay between
    each frame. The frames are taken by going from left-to-right
    across the first row, left-to-right across the second row, and
    so on until all frames are consumed, or a specified number of
    frames are taken.

    @param image: The image that the frames must be taken from.

    @param framesize: A (width, height) tuple giving the size of
    each of the frames in the animation.

    @param gridsize: A (columns, rows) tuple giving the number of
    columns and rows in the grid.

    @param delay: The delay, in seconds, between frames.

    @param frames: The number of frames in this animation. If None,
    then this defaults to colums * rows frames, that is, taking
    every frame in the grid.

    @param loop: If True, loop at the end of the animation. If False,
    this performs the animation once, and then stops.

    Other keyword arguments are as for anim.SMAnimation.
    i    i   N(	   R   t   rangeR&   R   R   R;   t   CropRV   RS   (   R
   t	   framesizet   gridsizeR   t   framest   loopR   RE   RF   t   colst   rowsR   R3   t   rt   ct   xt   y(    (    sk   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\anim.pyt	   Filmstrip9  s(     

(
(   t
   __future__R    t   renpy.displayR   t
   renpy.gamet
   renpy.easyR6   t   objectR   R   R   R   R   R(   RS   RO   Ra   R   R,   R|   (    (    (    sk   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\display\anim.pyt   <module>   s   7(÷	W`