ó
6…6ic           @   sø   d  d l  Z d  d l Z d  d l Z d Z e a d a d Z	 d Z
 e e d „ Z d d d „ Z e Z e Z i  Z e j e ƒ Z i  Z i  a e a d „  Z d „  Z d d	 „ Z d
 „  Z d e j j j f d „  ƒ  YZ d „  Z d „  Z d „  Z  d S(   iÿÿÿÿNi  i,  c         C   s+   t  r | r d St j j j d d ƒ d S(   s,   
    Stops the currently playing movie.
    Nt   channelt   movie(   t
   fullscreent   renpyt   audiot   musict   stop(   t   cleart   only_fullscreen(    (    sb   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\display\video.pyt
   movie_stop+   s    i    c         C   sz   t  j j r d S| d k	 r% | a n  |  g }  | d k rC t } n t } |  | d }  t  j j j	 |  d d d | ƒd S(   s&   
    This starts a movie playing.
    Niÿÿÿÿi   R    R   t   loop(
   R   t   gamet   less_updatest   Nonet   default_sizet   Truet   FalseR   R   t   play(   t   filenamet   sizet   loopsR
   (    (    sb   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\display\video.pyt   movie_start6   s    			c           C   s   t  j ƒ  t j ƒ  d S(   sU   
    Called early in the interact process, to clear out the fullscreen
    flag.
    N(   t   displayable_channelsR   t   channel_movie(    (    (    sb   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\display\video.pyt   early_interactc   s    
c          C   s•   x9 t  t j ƒ  ƒ D]% }  t j j j |  ƒ s t |  =q q Wt j j j d ƒ r‹ x= t j ƒ  D]  }  |  d d k r^ t a	 Pq^ q^ Wt
 a	 n t a	 t	 S(   sy   
    This is called each time the screen is drawn, and should return True
    if the movie should display fulscreen.
    R   i    (   t   listt   texturet   keysR   R   R   t   get_playingR   R   R   R   (   t   i(    (    sb   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\display\video.pyt   interactm   s    	c         C   s  t  j j j |  ƒ s d  t f St  j j j |  ƒ } | j ƒ  } | rj t  j j j | ƒ } | j ƒ  } n d  } | r° | r§ | r§ t  j j	 j
 | | t  j j j ƒ q° d  } n  | d  k	 rú t  j j j | ƒ t  j j j | t ƒ } | t |  <t } n t j |  d  ƒ } t } | | f S(   N(   R   R   R   R   R   R   t   get_channelt
   read_videot   displayt   modulet   alpha_munget   imt   identityt   rendert   mutated_surfacet   drawt   load_textureR   R   t   get(   R    t   mask_channelt   ct   surft   mct	   mask_surft   text   new(    (    sb   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\display\video.pyt   get_movie_textureˆ   s(    
%	
	c         C   sÿ   t  |  ƒ \ } } | d  k r" d  S| j ƒ  \ } } t d | | d | | ƒ } | | } | | }	 t j j j | | ƒ }
 t j j j d | d d d | ƒ |
 _	 t j j j | d d | ƒ |
 _
 |
 j | t | | d ƒ t | |	 d ƒ f ƒ |
 S(   Ng      ð?g        i   (   R2   R   t   get_sizet   minR   R!   R&   t   Rendert   Matrix2Dt   forwardt   reverset   blitt   int(   R    t   widtht   heightR0   t   _newt   swt   sht   scalet   dwt   dht   rv(    (    sb   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\display\video.pyt   render_movieª   s    

)!2t   Moviec           B   s}   e  Z d  Z e Z d Z d	 Z d	 Z d	 Z	 d	 Z
 d „  Z d d	 d d	 d	 d	 d	 d „ Z d „  Z d „  Z d „  Z d „  Z RS(
   sÀ  
    :doc: movie

    This is a displayable that shows the current movie.

    `fps`
        The framerate that the movie should be shown at. (This is currently
        ignored, but the parameter is kept for backwards compatibility.
        The framerate is auto-detected.)

    `size`
        This should be specified as either a tuple giving the width and
        height of the movie, or None to automatically adjust to the size
        of the playing movie. (If None, the displayable will be (0, 0)
        when the movie is not playing.)

    `channel`
        The audio channel associated with this movie. When a movie file
        is played on that channel, it will be displayed in this Movie
        displayable. If this is not given, and the `play` is provided,
        a channel name is automatically selected.

    `play`
        If given, this should be the path to a movie file. The movie
        file will be automatically played on `channel` when the Movie is
        shown, and automatically stopped when the movie is hidden.

    `mask`
        If given, this should be the path to a movie file that is used as
        the alpha channel of this displayable. The movie file will be
        automatically played on `movie_channel` when the Movie is shown,
        and automatically stopped when the movie is hidden.

    `mask_channel`
        The channel the alpha mask video is played on. If not given,
        defaults to `channel`_mask. (For example, if `channel` is "sprite",
        `mask_channel` defaults to "sprite_mask".)

    `image`
        An image that is displayed when `play` has been given, but the
        file it refers to does not exist. (For example, this can be used
        to create a slimmed-down mobile version that does not use movie
        sprites.) Users can also choose to fall back to this image as a
        preference if video is too taxing for their system.

    This displayable will be transparent when the movie is not playing.
    R   c      	   C   s[   | d  k r d  St j j j | ƒ r) d  St j j j | t j j d t d t	 d t ƒd  S(   NR
   t   stop_on_muteR   (
   R   R   R   R   t   channel_definedt   register_channelt   configt   movie_mixerR   R   (   t   selft   name(    (    sb   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\display\video.pyt   ensure_channelù   s
    i   c   	      K   s  t  t |  ƒ j |   | d k rI | rI t j j rI d j | | ƒ } n  | |  _ | |  _ | |  _	 | |  _
 | d  k r… d  |  _ n% | d  k r¡ | d |  _ n	 | |  _ |  j |  j ƒ |  j |  j ƒ t j j | ƒ |  _ |  j d k rt j j rt j rt d ƒ ‚ n  d  S(   NR   s   movie_{}_{}t   _maskso   Movie(channel='movie') doesn't work on mobile when config.hw_video is true. (Use a different channel argument.)(   t   superRE   t   __init__R   RI   t   auto_movie_channelt   formatR   R    t   _playt   maskR   R+   RM   t   easyt   displayable_or_nonet   imaget   hw_videot   mobilet	   Exception(	   RK   t   fpsR   R    R   RT   R+   RW   t
   properties(    (    sb   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\display\video.pyRP     s"    					$c         C   sç  |  j  d  k	 r® |  j d  k	 r® t j j |  j ƒ sI t j j j t	 k r® t j
 j j |  j  | | | | ƒ } | j ƒ  \ } } t j
 j j | | ƒ } | j | d ƒ | Sn  |  j rÇ |  t |  j <n  t j j j |  j ƒ }	 |  j d  k rst |  j |  j ƒ \ }
 } |	 rX|
 d  k	 rX|
 j ƒ  \ } } t j
 j j | | ƒ } | j |
 d ƒ qÍt j
 j j d d ƒ } nZ |  j \ } } |	 s‘d  } n t |  j | | ƒ } | d  k rÍt j
 j j | | ƒ } n  t j
 j j |  d ƒ | S(   Ni    gš™™™™™¹?(   i    i    (   i    i    (   RW   R   RS   R   t   loadert   loadableR   t   preferencest   video_image_fallbackR   R!   R&   R3   R5   R9   R   R    R   R   R   R   R2   R+   RD   t   redraw(   RK   R;   R<   t   stt   atR-   t   wt   hRC   t   playingR0   t   _(    (    sb   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\display\video.pyR&      s2    +$		c         C   sà   | d  k r d  } n	 | j } |  j | k rÜ |  j r› t j j j |  j d |  j d t d t ƒ|  j rÙ t j j j |  j d |  j	 d t d t ƒqÙ qÜ t j j j
 d |  j ƒ |  j rÜ t j j j
 d |  j	 ƒ qÜ n  d  S(   NR    R
   t   synchro_start(   R   RS   R   R   R   R   R    R   RT   R+   R   (   RK   t   oldt   old_play(    (    sb   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\display\video.pyR   S  s    			+	1	c         C   sN   |  j  rJ t j j j d |  j ƒ |  j rJ t j j j d |  j ƒ qJ n  d  S(   NR    (   RS   R   R   R   R   R    RT   R+   (   RK   (    (    sb   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\display\video.pyR   f  s    		c         C   s7   t  |  j |  j f j |  ƒ t j j j |  d ƒ d  S(   Ni    (   R   R    R+   t   appendR   R!   R&   Ra   (   RK   (    (    sb   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\display\video.pyt   per_interactm  s    N(   t   __name__t
   __module__t   __doc__R   R   R    R   RS   RT   R+   RW   RM   RP   R&   R   R   Rl   (    (    (    sb   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\display\video.pyRE   ¿   s   /	
	3		c          C   sS   t  j j j d ƒ r t Sx3 t D]+ }  |  \ } } t  j j j | ƒ r  t Sq  Wd  S(   NR   (   R   R   R   R   R   R   (   R   R    t   _mask_channel(    (    sb   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\display\video.pyRf   r  s    c          C   s‘   xH t  j ƒ  D]: \ }  } t j |  d ƒ } | | k	 r | j | ƒ q q Wx3 t j ƒ  D]% \ }  } |  t  k rX | j ƒ  qX qX Wt t  ƒ a d S(   s0   
    Calls play/stop on Movie displayables.
    N(   R   t   itemst   old_channel_movieR*   R   R   R   t   dict(   R,   t   mRi   (    (    sb   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\display\video.pyt   update_playing}  s    c          C   s6  t  ƒ  t j j j ƒ  t rê t }  xy t D]q } | \ } } t j j j | ƒ } | j ƒ  sg t }  Pn  | r* t j j j | ƒ } | j ƒ  s› t }  Pq› q* q* W|  ræ x> t j	 ƒ  D]- } x$ | D] } t j
 j j | d ƒ q¿ Wq² Wn  t St r2t j ot j j r2t j j j d ƒ } | j ƒ  r+t St Sn  t S(   sn   
    Called to update the video playback. Returns true if a video refresh is
    needed, false otherwise.
    g        R   (   Ru   R   R   t   advance_timeR   R   R   t   video_readyR   t   valuesR!   R&   Ra   R   RY   RI   RX   (   t   updateR   R    R+   R,   t   vt   j(    (    sb   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\display\video.pyt   frequent‘  s4    !(   i  i,  (!   t   renpy.displayR   t   renpy.audiot   collectionsR   t   current_movieR   R   R   t   surface_filet   surfaceR   R	   R   t   movie_start_fullscreent   movie_start_displayableR   t   defaultdictR   R   R   Rr   R   R   R2   RD   R!   t   coret   DisplayableRE   Rf   Ru   R|   (    (    (    sb   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\display\video.pyt   <module>   s0   	
	"	³		