Advertisement
neutale

Picture Transition

Jan 4th, 2020
1,616
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 35.55 KB | None | 0 0
  1. #encoding:utf-8
  2.  
  3. =begin
  4. *******************************************************************************************
  5.  
  6.    * Picture Transition *
  7.  
  8.                        for RGSS3
  9.  
  10.         Ver 1.2   2016.08.29
  11.  
  12.    Authot:魂(Lctseng),Bahamut forum ID:play123
  13.    
  14.  
  15.    For redistribution, please keep this label
  16.  
  17.    Website:http://home.gamer.com.tw/homeindex.php?owner=play123
  18.  
  19.    Required Base-Script: Lctseng - Enhanced Image Sprites
  20.    Please put this script below that script
  21.    
  22.    Main function:
  23.                        Left and right picture are displayed,
  24.                        are separated from the dialog box (if not related)
  25.                        
  26.  
  27.    Update log:
  28.     Ver 1.00 :
  29.     Date:2014.09.24
  30.     Summary:■、Initial release
  31.    
  32.    
  33.     Ver 1.10 :
  34.     Date:2014.10.30
  35.     Summary:■、added a way to adjust transparency
  36.    
  37.    
  38.     Ver 1.11 :
  39.     Date:2014.11.05
  40.     Summary:■、Fixed an error without adjusting transparency
  41.    
  42.     Ver 1.2 :
  43.     Date:2016.08.29
  44.     Summary:■、Remove the part of the dialog box with one more line
  45.    
  46.    
  47.     This script modifies or redefines the following categories:
  48.                            ■ Game_Interpreter
  49.                            ■ Game_System
  50.                            ■ Scene_Base
  51.                            ■ Scene_Map
  52.                          
  53.     This script defines the following categories and modules:
  54.                            ■ Lctseng::Game_StandController
  55.                            ■ Lctseng::Game_Stand
  56.                            ■ Lctseng::Game_LeftStand
  57.                            ■ Lctseng::Game_RightStand
  58.                            ■ Lctseng::Spriteset_Stand
  59.                            ■ Lctseng::Sprite_Stand
  60.                            ■ Lctseng::Sprite_LeftStand
  61.                            ■ Lctseng::Sprite_RightStand
  62.                          
  63.  
  64. *******************************************************************************************
  65. =end
  66.  
  67.  
  68. #*******************************************************************************************
  69. #
  70. #   DO NOT MODIFY UNLESS YOU KNOW WHAT TO DO !
  71. #
  72. #*******************************************************************************************
  73.  
  74. #--------------------------------------------------------------------------
  75. # ★ Log script information
  76. #--------------------------------------------------------------------------
  77. if !$lctseng_scripts  
  78.   $lctseng_scripts = {}
  79. end
  80.  
  81. ## Check for BaseScript
  82. if !$lctseng_scripts[:sprite_ex]
  83.   msgbox("No BaseScript found:Lctseng - Enhanced Image Sprites\nOr the script location is wrong!\nThe program is about to close")
  84.   exit
  85. end
  86.  
  87.  
  88. $lctseng_scripts[:stand_picture] = "1.11"
  89.  
  90. puts "Load Script:Lctseng - Picture Transition, Version:#{$lctseng_scripts[:stand_picture]}"
  91.  
  92.  
  93.  
  94. #encoding:utf-8
  95. #==============================================================================
  96. # ■ Game_Interpreter
  97. #------------------------------------------------------------------------------
  98. #  Interpreter of eventing.
  99. #   Class used inside Game_Map, Game_Troop, Game_Event.
  100. #==============================================================================
  101.  
  102. class Game_Interpreter
  103.   #--------------------------------------------------------------------------
  104.   # ● Left slide in
  105.   #--------------------------------------------------------------------------
  106.   def left_slide_in(*args)
  107.     $game_system.stand.left_slide_in(*args)
  108.   end
  109.   #--------------------------------------------------------------------------
  110.   # ● Left slide out
  111.   #--------------------------------------------------------------------------
  112.   def left_slide_out(*args)
  113.     $game_system.stand.left_slide_out(*args)
  114.   end
  115.   #--------------------------------------------------------------------------
  116.   # ● Left change
  117.   #--------------------------------------------------------------------------
  118.   def left_change(*args)
  119.     $game_system.stand.left_change(*args)
  120.   end
  121.  
  122.   #--------------------------------------------------------------------------
  123.   # ● Right slide in
  124.   #--------------------------------------------------------------------------
  125.   def right_slide_in(*args)
  126.     $game_system.stand.right_slide_in(*args)
  127.   end
  128.   #--------------------------------------------------------------------------
  129.   # ● Right slide in
  130.   #--------------------------------------------------------------------------
  131.   def right_slide_out(*args)
  132.     $game_system.stand.right_slide_out(*args)
  133.   end
  134.   #--------------------------------------------------------------------------
  135.   # ● Right change
  136.   #--------------------------------------------------------------------------
  137.   def right_change(*args)
  138.     $game_system.stand.right_change(*args)
  139.   end
  140.   #--------------------------------------------------------------------------
  141.   # ● Left picture Z coordinate change
  142.   #--------------------------------------------------------------------------
  143.   def left_z(val)
  144.     $game_system.stand.left.z = val
  145.   end
  146.   #--------------------------------------------------------------------------
  147.   # ● Right picture Z coordinate change
  148.   #--------------------------------------------------------------------------
  149.   def right_z(val)
  150.     $game_system.stand.right.z = val
  151.   end
  152.   #--------------------------------------------------------------------------
  153.   # ● Left picture in front of message window
  154.   #--------------------------------------------------------------------------
  155.   def left_front
  156.     left_z(500)
  157.   end
  158.   #--------------------------------------------------------------------------
  159.   # ● Left picture behind the message window
  160.   #--------------------------------------------------------------------------
  161.   def left_behind
  162.     left_z(50)
  163.   end
  164.   #--------------------------------------------------------------------------
  165.   # ● Right picture in front of message window
  166.   #-------------------------------------------------------------------------
  167.   def right_front
  168.     right_z(500)
  169.   end
  170.   #--------------------------------------------------------------------------
  171.   # ● Right picture behind the message window
  172.   #--------------------------------------------------------------------------
  173.   def right_behind
  174.     right_z(50)
  175.   end
  176.   #--------------------------------------------------------------------------
  177.   # ● Left image maximum transparency limit
  178.   #--------------------------------------------------------------------------
  179.   def left_limit_opacity(*args)
  180.     $game_system.stand.left_limit_opacity(*args)
  181.   end
  182.   #--------------------------------------------------------------------------
  183.   # ● Right image maximum transparency limit
  184.   #--------------------------------------------------------------------------
  185.   def right_limit_opacity(*args)
  186.     $game_system.stand.right_limit_opacity(*args)
  187.   end
  188.  
  189. end
  190.  
  191.  
  192. #encoding:utf-8
  193. #==============================================================================
  194. # ■ Game_System
  195. #------------------------------------------------------------------------------
  196. #  Class handles system data. Saves data and menu states.
  197. #  See $game_system for examples.
  198. #==============================================================================
  199.  
  200. class Game_System
  201.   #--------------------------------------------------------------------------
  202.   # ● Obtain standing drawing control objects
  203.   #--------------------------------------------------------------------------
  204.   def stand
  205.     @stand ||= Lctseng::Game_StandController.new
  206.   end
  207. end
  208.  
  209. #encoding:utf-8
  210. #==============================================================================
  211. # ■ Lctseng::Game_StandController
  212. #------------------------------------------------------------------------------
  213. #  Controlling vertical drawing objects
  214. #==============================================================================
  215.  
  216. module Lctseng
  217. class Game_StandController
  218.   #--------------------------------------------------------------------------
  219.   # ● Define instance variables
  220.   #--------------------------------------------------------------------------
  221.   attr_reader :left
  222.   attr_reader :right
  223.   #--------------------------------------------------------------------------
  224.   # ● Initialization object
  225.   #--------------------------------------------------------------------------
  226.   def initialize
  227.     @left = Game_LeftStand.new
  228.     @right = Game_RightStand.new
  229.   end
  230.   #--------------------------------------------------------------------------
  231.   # ● What to do when sprite group is released
  232.   #--------------------------------------------------------------------------
  233.   def on_terminate
  234.     # slide out
  235.     left_slide_out
  236.     right_slide_out
  237.   end
  238.   #--------------------------------------------------------------------------
  239.   # ● Left picture slide in
  240.   #--------------------------------------------------------------------------
  241.   def left_slide_in(filename)
  242.     @left.change_filename(filename)
  243.     @left.slide_in_req
  244.   end
  245.   #--------------------------------------------------------------------------
  246.   # ● Left picture slide out
  247.   #--------------------------------------------------------------------------
  248.   def left_slide_out
  249.     @left.slide_out_req
  250.   end
  251.   #--------------------------------------------------------------------------
  252.   # ● Left image maximum transparency limit
  253.   #--------------------------------------------------------------------------
  254.   def left_limit_opacity(value)
  255.     @left.limit_opacity(value)
  256.   end
  257.   #--------------------------------------------------------------------------
  258.   # ● Right picture slide in
  259.   #--------------------------------------------------------------------------
  260.   def right_slide_in(filename)
  261.     @right.change_filename(filename)
  262.     @right.slide_in_req
  263.   end
  264.   #--------------------------------------------------------------------------
  265.   # ● Right picture slide out
  266.   #--------------------------------------------------------------------------
  267.   def right_slide_out
  268.     @right.slide_out_req
  269.   end
  270.   #--------------------------------------------------------------------------
  271.   # ● Right image maximum transparency limit
  272.   #--------------------------------------------------------------------------
  273.   def right_limit_opacity(value)
  274.     @right.limit_opacity(value)
  275.   end
  276.   #--------------------------------------------------------------------------
  277.   # ● Left picture replacement
  278.   #--------------------------------------------------------------------------
  279.   def left_change(filename,fast = false)
  280.     @left.change(filename,fast)
  281.   end
  282.   #--------------------------------------------------------------------------
  283.   # ● Right picture replacement
  284.   #--------------------------------------------------------------------------
  285.   def right_change(filename,fast = false)
  286.     @right.change(filename,fast)
  287.   end
  288. end
  289. end
  290.  
  291. #encoding:utf-8
  292. #==============================================================================
  293. # ■ Lctseng::Game_Stand
  294. #------------------------------------------------------------------------------
  295. #  Standing property
  296. #==============================================================================
  297.  
  298. module Lctseng
  299. class Game_Stand
  300.   #--------------------------------------------------------------------------
  301.   # ● Define instance variables
  302.   #--------------------------------------------------------------------------
  303.   attr_reader :status
  304.   attr_reader :filename
  305.   attr_reader :new_filename
  306.   attr_reader :old_filename
  307.   attr_reader :change_fast
  308.   attr_reader :opacity_limit
  309.   attr_accessor :z
  310.   #--------------------------------------------------------------------------
  311.   # ● Initialization object
  312.   #--------------------------------------------------------------------------
  313.   def initialize
  314.     # Filename
  315.     @filename = ''
  316.     # status:
  317.     # :none
  318.     # :slide_in_req
  319.     # :sliding_in  
  320.     # slide_out_req  
  321.     # :sliding_out  
  322.     # :show
  323.     # :change_req
  324.     # :changing
  325.     @status = :none
  326.     # New filename when changing [only effective when show]
  327.     @new_filename = ''
  328.     # Old filename when changing [only effective when show]
  329.     @old_filename = ''
  330.     # Whether to change quickly when replacing
  331.     @change_fast = false
  332.     #  Z coordinate
  333.     @z = 300
  334.     # Maximum transparency
  335.     @opacity_limit = 255
  336.   end
  337.  
  338.   #--------------------------------------------------------------------------
  339.   # ● response to slide in
  340.   #--------------------------------------------------------------------------
  341.   def response_slide_in
  342.     @status = :sliding_in
  343.   end
  344.   #--------------------------------------------------------------------------
  345.   # ● end response to slide in
  346.   #--------------------------------------------------------------------------
  347.   def response_slide_in_end
  348.     @status = :show
  349.   end
  350.   #--------------------------------------------------------------------------
  351.   # ● response to slide out
  352.   #--------------------------------------------------------------------------
  353.   def response_slide_out
  354.     @status = :sliding_out
  355.   end
  356.   #--------------------------------------------------------------------------
  357.   # ● end response to slide out
  358.   #--------------------------------------------------------------------------
  359.   def response_slide_out_end
  360.     @status = :none
  361.   end
  362.   #--------------------------------------------------------------------------
  363.   # ● response change
  364.   #--------------------------------------------------------------------------
  365.   def response_change_req
  366.     @status = :changing
  367.   end
  368.   #--------------------------------------------------------------------------
  369.   # ● end response change
  370.   #--------------------------------------------------------------------------
  371.   def response_change_end
  372.     @status = :show
  373.   end
  374.   #--------------------------------------------------------------------------
  375.   # ● change filename (new)
  376.   #--------------------------------------------------------------------------
  377.   def change_filename(new_name)
  378.     @old_filename = @filename
  379.     @new_filename = @filename = new_name
  380.   end
  381.   #--------------------------------------------------------------------------
  382.   # ● change requirement
  383.   #--------------------------------------------------------------------------
  384.   def change(new_name,fast)
  385.     @change_fast = fast
  386.     change_filename(new_name)
  387.     @status = :change_req
  388.   end
  389.   #--------------------------------------------------------------------------
  390.   # ● slide in requirement
  391.   #--------------------------------------------------------------------------
  392.   def slide_in_req
  393.     @status = :slide_in_req
  394.   end
  395.   #--------------------------------------------------------------------------
  396.   # ● slide out requirement
  397.   #--------------------------------------------------------------------------
  398.   def slide_out_req
  399.     @status = :slide_out_req if @status != :none
  400.   end
  401.   #--------------------------------------------------------------------------
  402.   # ● Limiting transparency
  403.   #--------------------------------------------------------------------------
  404.   def limit_opacity(value)
  405.     @opacity_limit = value
  406.   end
  407.  
  408. end
  409. end
  410.  
  411. #encoding:utf-8
  412. #==============================================================================
  413. # ■ Lctseng::Game_LeftStand
  414. #------------------------------------------------------------------------------
  415. #  Left picture
  416. #==============================================================================
  417.  
  418. module Lctseng
  419. class Game_LeftStand < Game_Stand
  420.   #--------------------------------------------------------------------------
  421.   # ● Initialization object
  422.   #--------------------------------------------------------------------------
  423.   def initialize
  424.     super
  425.   end
  426.  
  427.  
  428. end
  429. end
  430.  
  431. #encoding:utf-8
  432. #==============================================================================
  433. # ■ Lctseng::Game_RightStand
  434. #------------------------------------------------------------------------------
  435. #  Right picture object
  436. #==============================================================================
  437.  
  438. module Lctseng
  439. class Game_RightStand < Game_Stand
  440.   #--------------------------------------------------------------------------
  441.   # ● Initialization object
  442.   #--------------------------------------------------------------------------
  443.   def initialize
  444.     super
  445.   end
  446.  
  447.  
  448. end
  449. end
  450.  
  451. #encoding:utf-8
  452. #==============================================================================
  453. # ■ Lctseng::Spriteset_Stand
  454. #------------------------------------------------------------------------------
  455. #     Handling picture area
  456. #     Game_StandController for picture transition
  457. #==============================================================================
  458. module Lctseng
  459. class Spriteset_Stand
  460.   #--------------------------------------------------------------------------
  461.   # ● Add settings module
  462.   #--------------------------------------------------------------------------
  463.   #--------------------------------------------------------------------------
  464.   # ● Initialization object
  465.   #--------------------------------------------------------------------------
  466.   def initialize(viewport)
  467.     @viewport = viewport
  468.     @terminating_count = 0
  469.     create_sprites
  470.   end
  471.   #--------------------------------------------------------------------------
  472.   # ● Get control
  473.   #--------------------------------------------------------------------------
  474.   def control
  475.     $game_system.stand
  476.   end
  477.   #--------------------------------------------------------------------------
  478.   # ● create sprite
  479.   #--------------------------------------------------------------------------
  480.   def create_sprites
  481.     @left = Lctseng::Sprite_LeftStand.new(@viewport)
  482.     @right = Lctseng::Sprite_RightStand.new(@viewport)
  483.   end
  484.   #--------------------------------------------------------------------------
  485.   # ● dispose
  486.   #--------------------------------------------------------------------------
  487.   def dispose
  488.     dispose_sprites
  489.   end
  490.   #--------------------------------------------------------------------------
  491.   # ● dispose sprites
  492.   #--------------------------------------------------------------------------
  493.   def dispose_sprites
  494.     @left.dispose
  495.     @right.dispose
  496.   end
  497.   #--------------------------------------------------------------------------
  498.   # ● show sprite
  499.   #--------------------------------------------------------------------------
  500.   def any_sprite_show?
  501.     return true if @left&&@left.control.status != :none
  502.     return true if @right&&@right.control.status != :none
  503.     return false
  504.   end
  505.   #--------------------------------------------------------------------------
  506.   # ● update
  507.   #--------------------------------------------------------------------------
  508.   def update
  509.     update_sprites
  510.   end
  511.   #--------------------------------------------------------------------------
  512.   # ● update sprite
  513.   #--------------------------------------------------------------------------
  514.   def update_sprites
  515.     @left.update
  516.     @right.update
  517.   end
  518.   #--------------------------------------------------------------------------
  519.   # ● End countdown
  520.   #--------------------------------------------------------------------------
  521.   def terminate_countdown
  522.     @terminating_count -= 1
  523.   end
  524.  
  525.   #--------------------------------------------------------------------------
  526.   # ● terminate?
  527.   #--------------------------------------------------------------------------
  528.   def terminating?
  529.     @terminating_count > 0
  530.   end
  531.   #--------------------------------------------------------------------------
  532.   # ● terminate
  533.   #--------------------------------------------------------------------------
  534.   def terminate
  535.     puts "Terminate processing"
  536.     control.on_terminate
  537.     if any_sprite_show?
  538.       puts "Show before request termination"
  539.       @terminating_count  = 35
  540.     end
  541.   end
  542.  
  543. end
  544. end
  545.  
  546. #encoding:utf-8
  547. #==============================================================================
  548. # ■ Lctseng::Sprite_Stand
  549. #------------------------------------------------------------------------------
  550. #     Picture
  551. #==============================================================================
  552. module Lctseng
  553. class Sprite_Stand < Sprite_Base
  554.   #--------------------------------------------------------------------------
  555.   # ● Add fade in and fade out modules
  556.   #--------------------------------------------------------------------------
  557.   include SpriteFader
  558.   include SpriteSlider
  559.   #--------------------------------------------------------------------------
  560.   # ● Initialization object
  561.   #--------------------------------------------------------------------------
  562.   def initialize(viewport)
  563.     @opacity_limit = 255
  564.     @origin_opacity = 255
  565.     super(viewport)
  566.     @origin_opacity = self.opacity
  567.     @filename = ''
  568.     check_opacity
  569.     fader_init
  570.     slider_init
  571.     @shadow = Sprite_StandShadow.new(self,viewport)
  572.   end
  573.   #--------------------------------------------------------------------------
  574.   # ● Get Control Object
  575.   #--------------------------------------------------------------------------
  576.   def control
  577.   end
  578.   #--------------------------------------------------------------------------
  579.   # ● Update
  580.   #--------------------------------------------------------------------------
  581.   def update
  582.     super
  583.     check_opacity
  584.     check_action
  585.     fader_update
  586.     slider_update
  587.     self.z = control.z
  588.     @shadow.update
  589.   end
  590.   #--------------------------------------------------------------------------
  591.   # ● Set transparency
  592.   #--------------------------------------------------------------------------
  593.   alias :set_opacity :opacity=
  594.   #--------------------------------------------------------------------------
  595.   def opacity=(val)
  596.     @origin_opacity = val
  597.     adj = [@origin_opacity,@opacity_limit].min
  598.     set_opacity(adj)
  599.   end
  600.   #--------------------------------------------------------------------------
  601.   # ● Check transparency
  602.   #--------------------------------------------------------------------------
  603.   def check_opacity
  604.     if  @opacity_limit != control.opacity_limit
  605.       @opacity_limit = control.opacity_limit
  606.       self.opacity = @origin_opacity
  607.     end
  608.   end
  609.   #--------------------------------------------------------------------------
  610.   # ● Check action
  611.   #--------------------------------------------------------------------------
  612.   def check_action
  613.     #puts "status:#{control.status}"
  614.     case control.status
  615.     when :none
  616.       hide
  617.     when :slide_in_req
  618.       check_filename
  619.       reset_position
  620.       slide_in
  621.       control.response_slide_in
  622.     when :sliding_in
  623.       if !slider_sliding?
  624.         control.response_slide_in_end
  625.       end
  626.     when :slide_out_req
  627.       slide_out
  628.       control.response_slide_out
  629.     when :sliding_out
  630.       if !slider_sliding?
  631.         control.response_slide_out_end
  632.       end
  633.     when :change_req
  634.       if control.change_fast
  635.         change_immediately
  636.         control.response_change_end
  637.       else
  638.         setup_shadow
  639.         control.response_change_req
  640.       end
  641.     when :changing
  642.       if !fader_fading? && !@shadow.fader_fading?
  643.         control.response_change_end
  644.       end
  645.     end
  646.   end
  647.   #--------------------------------------------------------------------------
  648.   # ● hide
  649.   #--------------------------------------------------------------------------
  650.   def hide
  651.     self.opacity = 0
  652.   end
  653.   #--------------------------------------------------------------------------
  654.   # ● check filename
  655.   #--------------------------------------------------------------------------
  656.   def check_filename
  657.     # If the file is replaced, re-create the bitmap
  658.     if @filename != control.filename
  659.       change_immediately
  660.     end
  661.   end
  662.   #--------------------------------------------------------------------------
  663.   # ● Reset position
  664.   #--------------------------------------------------------------------------
  665.   def reset_position
  666.     return unless self.bitmap
  667.     set_pos(slided_out_pos)
  668.   end
  669.   #--------------------------------------------------------------------------
  670.   # ● Slide in position
  671.   #--------------------------------------------------------------------------
  672.   def slided_in_pos
  673.     [0,Graphics.height - self.height]
  674.   end
  675.   #--------------------------------------------------------------------------
  676.   # ● Slide out of position
  677.   #--------------------------------------------------------------------------
  678.   def slided_out_pos
  679.     [-0.5 * self.width,Graphics.height - self.height]
  680.   end
  681.   #--------------------------------------------------------------------------
  682.   # ● dispose
  683.   #--------------------------------------------------------------------------
  684.   def dispose
  685.     super
  686.     @shadow.dispose
  687.   end
  688.   #--------------------------------------------------------------------------
  689.   # ● slide in
  690.   #--------------------------------------------------------------------------
  691.   def slide_in
  692.     fader_set_fade(255,30)
  693.     slider_set_move(current_pos,slided_in_pos,30)
  694.   end
  695.   #--------------------------------------------------------------------------
  696.   # ● slide out
  697.   #--------------------------------------------------------------------------
  698.   def slide_out
  699.     fader_set_fade(0,30)
  700.     slider_set_move(current_pos,slided_out_pos,30)
  701.   end
  702.   #--------------------------------------------------------------------------
  703.   # ● instant change
  704.   #--------------------------------------------------------------------------
  705.   def change_immediately
  706.     @filename = control.filename
  707.     self.bitmap = Cache.picture(@filename)
  708.     # Realign coordinates
  709.     set_pos(slide_in_pos_adjust(slided_in_pos))
  710.     # Set transparency
  711.     self.opacity = 255
  712.   end
  713.   #--------------------------------------------------------------------------
  714.   # ● Set shadow
  715.   # Uses an old picture as an afterimage, and master sprite fades in with new picture
  716.   #--------------------------------------------------------------------------
  717.   def setup_shadow
  718.     @shadow.setup
  719.     change_immediately
  720.     self.opacity = 0
  721.     fader_set_fade(255,30)
  722.   end
  723.   #--------------------------------------------------------------------------
  724.   # ● Slide into position adjustment
  725.   #--------------------------------------------------------------------------
  726.   def slide_in_pos_adjust(pos)
  727.     pos
  728.   end
  729. end
  730. end
  731.  
  732. #encoding:utf-8
  733. #==============================================================================
  734. # ■ Lctseng::Sprite_StandShadow
  735. #------------------------------------------------------------------------------
  736. # Draws a shadow sprite. When main sprite changes the picture, it fades out.
  737. #==============================================================================
  738. module Lctseng
  739. class Sprite_StandShadow < Sprite_Base
  740.   #--------------------------------------------------------------------------
  741.   # ● Add fade in and fade out modules
  742.   #--------------------------------------------------------------------------
  743.   include SpriteFader
  744.   #--------------------------------------------------------------------------
  745.   # ● Initialization object
  746.   #--------------------------------------------------------------------------
  747.   def initialize(main,viewport)
  748.     super(viewport)
  749.     @main = main
  750.     fader_init
  751.   end
  752.  
  753.   #--------------------------------------------------------------------------
  754.   # ● Update
  755.   #--------------------------------------------------------------------------
  756.   def update
  757.     super
  758.     fader_update
  759.   end
  760.   #--------------------------------------------------------------------------
  761.   # ● Setup
  762.   #--------------------------------------------------------------------------
  763.   def setup
  764.     self.bitmap = Cache.picture(@main.control.old_filename)
  765.     self.opacity = @main.opacity
  766.     self.x = @main.x
  767.     self.y = @main.y
  768.     fader_set_fade(0,30)
  769.   end
  770. end
  771. end
  772.  
  773.  
  774. #encoding:utf-8
  775. #==============================================================================
  776. # ■ Lctseng::Sprite_LeftStand
  777. #------------------------------------------------------------------------------
  778. #     Left picture
  779. #==============================================================================
  780. module Lctseng
  781. class Sprite_LeftStand < Sprite_Stand
  782.   #--------------------------------------------------------------------------
  783.   # ● Get control object
  784.   #--------------------------------------------------------------------------
  785.   def control
  786.     $game_system.stand.left
  787.   end
  788.   #--------------------------------------------------------------------------
  789.   # ● Reset position
  790.   #--------------------------------------------------------------------------
  791.   def reset_position
  792.     return unless self.bitmap
  793.     super
  794.     self.x = self.width * -0.5
  795.   end
  796.   #--------------------------------------------------------------------------
  797.   # ● Slide in position
  798.   #--------------------------------------------------------------------------
  799.   def slided_in_pos
  800.     pos = super
  801.     pos[0] = 0 # x coordinate is 0
  802.     slide_in_pos_adjust(pos)
  803.   end
  804.   #--------------------------------------------------------------------------
  805.   # ● Slide in position adjustment
  806.   #--------------------------------------------------------------------------
  807.   def slide_in_pos_adjust(pos)
  808.     # No more than half
  809.     if pos[0] + self.width > 320
  810.       pos[0] = 320 - self.width
  811.     end
  812.     pos
  813.   end
  814.   #--------------------------------------------------------------------------
  815.   # ● Slide out of position
  816.   #--------------------------------------------------------------------------
  817.   def slided_out_pos
  818.     pos = super
  819.     pos[0] = -0.5 * self.width # x-coordinate is half the width
  820.     pos
  821.   end
  822.  
  823. end
  824. end
  825.  
  826.  
  827. #encoding:utf-8
  828. #==============================================================================
  829. # ■ Lctseng::Sprite_RightStand
  830. #------------------------------------------------------------------------------
  831. #     Right standing area
  832. #==============================================================================
  833. module Lctseng
  834. class Sprite_RightStand < Sprite_Stand
  835.   #--------------------------------------------------------------------------
  836.   # ● Get Control Object
  837.   #--------------------------------------------------------------------------
  838.   def control
  839.     $game_system.stand.right
  840.   end
  841.   #--------------------------------------------------------------------------
  842.   # ● Reset position
  843.   #--------------------------------------------------------------------------
  844.   def reset_position
  845.     return unless self.bitmap
  846.     super
  847.     self.x = Graphics.width - self.width * 0.5
  848.   end
  849.   #--------------------------------------------------------------------------
  850.   # ● slide in position
  851.   #--------------------------------------------------------------------------
  852.   def slided_in_pos
  853.     pos = super
  854.     pos[0] = Graphics.width - self.width
  855.     slide_in_pos_adjust(pos)
  856.   end
  857.   #--------------------------------------------------------------------------
  858.   # ● slide in position adjustment
  859.   #--------------------------------------------------------------------------
  860.   def slide_in_pos_adjust(pos)
  861.     # 限制不過半
  862.     if pos[0] < 320
  863.       pos[0] = 320
  864.     end
  865.     pos
  866.   end
  867.   #--------------------------------------------------------------------------
  868.   # ● slide out position
  869.   #--------------------------------------------------------------------------
  870.   def slided_out_pos
  871.     pos = super
  872.     pos[0] = Graphics.width - self.width * 0.5
  873.     pos
  874.   end
  875. end
  876. end
  877.  
  878. #encoding:utf-8
  879. #==============================================================================
  880. # ■ Scene_Base
  881. #------------------------------------------------------------------------------
  882. #  Parent of all Scene classes
  883. #==============================================================================
  884.  
  885. class Scene_Base
  886.   #--------------------------------------------------------------------------
  887.   # ● redefine
  888.   #--------------------------------------------------------------------------
  889.   unless $@
  890.     alias lctseng_stand_start start
  891.     alias lctseng_stand_update_basic update_basic
  892.     alias lctseng_stand_terminate terminate
  893.   end
  894.   #--------------------------------------------------------------------------
  895.   # ● Start processing [Redefined]
  896.   #--------------------------------------------------------------------------
  897.   def start
  898.     lctseng_stand_start
  899.     #create_stand_viewport
  900.     create_stand_spriteset
  901.   end
  902.   #--------------------------------------------------------------------------
  903.   # ● Generate vertical drawing display port
  904.   #--------------------------------------------------------------------------
  905.   def create_stand_viewport
  906.     @viewport_stand = Viewport.new
  907.     @viewport_stand.z = 100
  908.   end
  909.   #--------------------------------------------------------------------------
  910.   # ● Spawn area sprite
  911.   #--------------------------------------------------------------------------
  912.   def create_stand_spriteset
  913.     # Modify by not using display port to control Z coordinate
  914.     @stand_spriteset = Lctseng::Spriteset_Stand.new(nil)
  915.   end
  916.   #--------------------------------------------------------------------------
  917.   # ● Update screen (basic) [redefined]
  918.   #--------------------------------------------------------------------------
  919.   def update_basic
  920.     lctseng_stand_update_basic
  921.     update_stand_spriteset
  922.   end
  923.   #--------------------------------------------------------------------------
  924.   # ● Update picture sprite
  925.   #--------------------------------------------------------------------------
  926.   def update_stand_spriteset
  927.     @stand_spriteset.update
  928.   end
  929.   #--------------------------------------------------------------------------
  930.   # ● End processing [redefined]
  931.   #--------------------------------------------------------------------------
  932.   def terminate
  933.     stand_terminate
  934.     lctseng_stand_terminate
  935.     dispose_stand_spriteset
  936.     #dispose_stand_viewport
  937.   end
  938.   #--------------------------------------------------------------------------
  939.   # ● dispose picture sprite
  940.   #--------------------------------------------------------------------------
  941.   def dispose_stand_spriteset
  942.     @stand_spriteset.dispose
  943.   end
  944.   #--------------------------------------------------------------------------
  945.   # ● dispose upright display port
  946.   #--------------------------------------------------------------------------
  947.   def dispose_stand_viewport
  948.     @viewport_stand.dispose
  949.   end
  950.   #--------------------------------------------------------------------------
  951.   # ● Standing painting finish processing
  952.   #--------------------------------------------------------------------------
  953.   def stand_terminate
  954.     @stand_spriteset.terminate
  955.     while @stand_spriteset.terminating?
  956.       @stand_spriteset.terminate_countdown
  957.       puts "Processing"
  958.       @stand_spriteset.update
  959.       Graphics.update
  960.     end
  961.   end
  962.  
  963. end
  964.  
  965. #encoding:utf-8
  966. #==============================================================================
  967. # ■ Scene_Map
  968. #------------------------------------------------------------------------------
  969. #  Map screen
  970. #==============================================================================
  971.  
  972. class Scene_Map < Scene_Base
  973.   #--------------------------------------------------------------------------
  974.   # ● redefine
  975.   #--------------------------------------------------------------------------
  976.   unless $@
  977.     alias lctseng_stand_pre_transfer pre_transfer
  978.   end
  979.  
  980.   #--------------------------------------------------------------------------
  981.   # ● Location move [redefined]
  982.   #--------------------------------------------------------------------------
  983.   def pre_transfer
  984.     puts "Transfer processing"
  985.     stand_terminate
  986.     lctseng_stand_pre_transfer
  987.   end
  988. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement