khanhdu

Cập Nhật Lần 3

May 25th, 2017
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 25.65 KB | None | 0 0
  1. #==============================================================================
  2. # TheoAllen - Message Balloon
  3. # Version : 2.0b
  4. # Contact : www.rpgmakerid.com (or) http://theolized.blogspot.com
  5. # (This script documentation is written in informal indonesian language)
  6. #==============================================================================
  7. ($imported ||= {})[:Theo_MessageBalloonV2] = true
  8. #==============================================================================
  9. # Change Logs :
  10. #------------------------------------------------------------------------------
  11. # 2015.10.28 - Fix bug where balloon message isn't displayed after transfer map
  12. # 2014.12.26 - Rewrite for version 2.0
  13. #            - Get rid gradient background. Bring back windowskin
  14. #            - Added opening animation
  15. #            - Added <bm:x> tag for subject
  16. #            - Compatibility with Namebox window
  17. # 2013.09.05 - Finished script
  18. #==============================================================================
  19. =begin
  20.  
  21.   ==================
  22.   *) Perkenalan :
  23.   ------------------
  24.   Script ini ngebikin kamu nampilin dialog dalam balloon diatas karakter
  25.  
  26.   =======================
  27.   *) Cara penggunaan :
  28.   -----------------------
  29.   Pasang dibawah material namun diatas main.
  30.   Masukkan gambar untuk ballon pointer di Graphics/system. Dan jangan lupa
  31.   dinamain "ballonpointer".
  32.  
  33.   Edit konfigurasinya dan ikuti aturan script call berikut
  34.  
  35.   =======================
  36.   *) Script Calls :
  37.   -----------------------
  38.   - message.balloon
  39.   Panggil script call seperti ini untuk membuat text ditampilkan dalam model
  40.   balloon
  41.  
  42.   - message.normal
  43.   Panggil script call seperti ini untuk mengembalikan message seperti biasa
  44.  
  45.   - message.subject = angka
  46.   Panggil script call seperti ini untuk menentukan subject yang berbicara.
  47.   Angka disana adalah event ID. Jika kamu memasukkan 0, maka yang akan
  48.   berbicara adalah player. Jika event ID tidak ada, maka message akan
  49.   berubah seperti biasa
  50.  
  51.   Atau jika kalian kerepotan untuk membuat script call, kalian bisa memakai tag
  52.   <bm:x> pada kotak dimana x adalah event ID tersebut. Contoh
  53.  
  54.   <bm:1>Hai, apa kabar?
  55.  
  56.   =======================
  57.   *) Terms of use :
  58.   -----------------------
  59.   Credit gw, TheoAllen. Kalo semisal u bisa ngedit2 script gw trus jadi lebih
  60.   keren, terserah. Ane bebasin. Asal ngga ngeklaim aja. Kalo semisal mau
  61.   dipake buat komersil, jangan lupa, gw dibagi gratisannya.
  62.  
  63. =end
  64. #==============================================================================
  65. # Konfigurasi :
  66. #==============================================================================
  67. module Theo
  68.   module Msg
  69.  
  70.   # Jarak keatas message balloon (default: 32)
  71.     Buffer_Y     = 45#42
  72.  
  73.   # Ukuran font dalam balloon  
  74.     FontSize     = 22
  75.  
  76.   # Batas minimum lebar window
  77.     MinimumWidth = 0
  78.    
  79.   # Gunakan animasi opening untuk mode balloon? (Butuh: Theo Basic Module)
  80.     UseOpening   = true
  81.    
  82.   # Kecepatan opening
  83.     OpeningSpeed = 15
  84.    
  85.   # Warna popup opening (red, green, blue)
  86.     OpeningColor = Color.new(255,255,255)
  87.    
  88.   # Opening SE. Tuliskan dengan RPG::SE.new('nama', volume, pitch)
  89.   # Isi dengan nil jika tidak digunakan
  90.     OpeningSE = RPG::SE.new('System_Popup_ON', 80, 150)
  91.    
  92.   # Closing SE. Tuliskan dengan RPG::SE.new('nama', volume, pitch)
  93.   # Isi dengan nil jika tidak digunakan
  94.     ClosingSE = nil
  95.    
  96.   end
  97. end
  98. #==============================================================================
  99. # Akhir dari konfigurasi
  100. #==============================================================================
  101.  
  102. #==============================================================================
  103. # ** Game_Interpreter
  104. #==============================================================================
  105.  
  106. class Game_Interpreter
  107.    
  108.   # Shortcut
  109.   def message
  110.     $game_message
  111.   end
  112.  
  113. end
  114.  
  115. #==============================================================================
  116. # ** Global window, taken from Sprite Extension
  117. #==============================================================================
  118.  
  119. module Theo
  120.   #--------------------------------------------------------------------------
  121.   # * Get Global Window
  122.   #--------------------------------------------------------------------------
  123.   def self.window
  124.     if @window.nil? || @window.disposed?
  125.       @window = Window_Base.new(0,0,1,1)
  126.       @window.visible = false
  127.       @window.gobj_exempt if @window.respond_to?(:gobj_exempt)
  128.       # Compatibility with mithran's
  129.     end
  130.     return @window
  131.   end
  132.  
  133. end
  134.  
  135. #==============================================================================
  136. # ** Bitmap
  137. #==============================================================================
  138.  
  139. class Bitmap
  140.   #--------------------------------------------------------------------------
  141.   # * Border fill
  142.   #--------------------------------------------------------------------------
  143.   def border_fill(color)
  144.     fill_rect(0,0,width,1,color)
  145.     fill_rect(0,0,1,height,color)
  146.     fill_rect(width-1,0,1,height,color)
  147.     fill_rect(0,height-1,width,1,color)
  148.   end
  149.  
  150. end
  151.  
  152. #==============================================================================
  153. # ** Point. To store x and y
  154. #==============================================================================
  155.  
  156. class Point
  157.   #--------------------------------------------------------------------------
  158.   # * Public attributes
  159.   #--------------------------------------------------------------------------
  160.   attr_accessor :x
  161.   attr_accessor :y
  162.   #--------------------------------------------------------------------------
  163.   # * Initialize
  164.   #--------------------------------------------------------------------------
  165.   def initialize(x,y)
  166.     @x, @y = x, y
  167.   end
  168.  
  169. end
  170.  
  171. #==============================================================================
  172. # ** Game_Message
  173. #==============================================================================
  174.  
  175. class Game_Message
  176.   #--------------------------------------------------------------------------
  177.   # * Escape char junk
  178.   #--------------------------------------------------------------------------
  179.   Junk_EscapeChar = [
  180.   /\eNBL\['.*'\]/i,
  181.   /\eNBR\['.*'\]/i,
  182.   /\eNBL\[\d+\]/i,
  183.   /\eNBR\[\d+\]/i,
  184.   /\e\^/,
  185.   /\e\./,
  186.   /\e\|/,
  187.   /\e\$/,
  188.   /\e\>/,
  189.   /\e\</,
  190.   /\e\!/,
  191.   ]
  192.  
  193.   #--------------------------------------------------------------------------
  194.   # * Public attributes
  195.   #--------------------------------------------------------------------------
  196.   attr_accessor :balloon_refresh
  197.   attr_accessor :subject
  198.   attr_reader :type
  199.  
  200.   #--------------------------------------------------------------------------
  201.   # * Alias : Initialize
  202.   #--------------------------------------------------------------------------
  203.   alias theo_msgballoon_init initialize
  204.   def initialize
  205.     theo_msgballoon_init
  206.     @subject = 0
  207.     normal
  208.   end
  209.  
  210.   #--------------------------------------------------------------------------
  211.   # * Switch to balloon
  212.   #--------------------------------------------------------------------------
  213.   def balloon
  214.     @type = :balloon
  215.     @balloon_refresh = true
  216.   end
  217.  
  218.   #--------------------------------------------------------------------------
  219.   # * Switch to normal
  220.   #--------------------------------------------------------------------------
  221.   def normal
  222.     @type = :normal
  223.     @balloon_refresh = true
  224.   end
  225.  
  226.   #--------------------------------------------------------------------------
  227.   # * Balloon mode is on?
  228.   #--------------------------------------------------------------------------
  229.   def balloon?
  230.     return false unless SceneManager.scene_is?(Scene_Map)
  231.     @type == :balloon && @subject > -1 && !get_char.nil?
  232.   end
  233.  
  234.   #--------------------------------------------------------------------------
  235.   # * Convert escape char for width calculation
  236.   #--------------------------------------------------------------------------
  237.   def convert_escape_characters(text)
  238.     result = Theo.window.convert_escape_characters(text)
  239.     result.gsub!(/\eC\[\d+\]/i) { "" }        # Destroy change color code
  240.     result.gsub!(/\eI\[\d+\]/i) { "      " }  # Destroy draw icon
  241.     result.gsub!(/<bm:\s*(\d+)>/i) do
  242.       @subject = $1.to_i
  243.       ""
  244.     end
  245.     Junk_EscapeChar.each do |esc|  
  246.       result.gsub!(esc) { "" }
  247.     end
  248.     return result
  249.   end
  250.  
  251.   #--------------------------------------------------------------------------
  252.   # * Get longest text
  253.   #--------------------------------------------------------------------------
  254.   def longest_text
  255.     test = Theo.window.contents
  256.     test.font.size = Theo::Msg::FontSize
  257.     txts = []
  258.     @texts.each do |txt|
  259.       txts.push(convert_escape_characters(txt))
  260.     end
  261.     longest = txts.sort do |a,b|
  262.       test.text_size(b).width <=> test.text_size(a).width
  263.     end[0]
  264.     result = test.text_size(longest).width
  265.     return [result, Theo::Msg::MinimumWidth].max
  266.   end
  267.  
  268.   #--------------------------------------------------------------------------
  269.   # * Get character
  270.   #--------------------------------------------------------------------------
  271.   def get_char
  272.     if @subject == 0
  273.       player = $game_player
  274.       return Point.new(player.screen_x, player.screen_y)
  275.     else
  276.       event = $game_map.events[@subject]
  277.       return nil unless event
  278.       return Point.new(event.screen_x, event.screen_y)
  279.     end
  280.   end
  281.  
  282.   #--------------------------------------------------------------------------
  283.   # * Total text
  284.   #--------------------------------------------------------------------------
  285.   def total_text
  286.     @texts.size
  287.   end
  288.  
  289. end
  290.  
  291. #==============================================================================
  292. # ** BalloonPointer
  293. #==============================================================================
  294.  
  295. class BalloonPointer < Sprite
  296.   #--------------------------------------------------------------------------
  297.   # * Public Attributes
  298.   #--------------------------------------------------------------------------
  299.   attr_reader :window
  300.   attr_reader :pos
  301.  
  302.   #--------------------------------------------------------------------------
  303.   # *
  304.   #--------------------------------------------------------------------------
  305.   def initialize(viewport,window)
  306.     super(viewport)
  307.     @window = window
  308.     @pos = :upper
  309.     self.bitmap = Cache.system("ballonpointer")#("ballonpointer")
  310.     to_center
  311.     update
  312.   end
  313.  
  314.   #--------------------------------------------------------------------------
  315.   # * Position
  316.   #--------------------------------------------------------------------------
  317.   def pos=(pos)
  318.     @pos = pos
  319.     update_placement
  320.   end
  321.  
  322.   #--------------------------------------------------------------------------
  323.   # * To center
  324.   #--------------------------------------------------------------------------
  325.   def to_center
  326.     self.ox = width/2
  327.     self.oy = height
  328.   end
  329.  
  330.   #--------------------------------------------------------------------------
  331.   # * Update
  332.   #--------------------------------------------------------------------------
  333.   def update
  334.     super
  335.     if window.balloon?
  336.       self.visible = window.open?
  337.       update_placement
  338.     else
  339.       self.visible = false
  340.     end
  341.   end
  342.  
  343.   #--------------------------------------------------------------------------
  344.   # * Update Placement
  345.   #--------------------------------------------------------------------------
  346.   def update_placement
  347.     self.x = window.char.x
  348.     if pos == :upper
  349.       self.y = window.char.y - 32
  350.       self.angle = 0
  351.     else
  352.       self.angle = 180
  353.       self.y = window.char.y
  354.     end
  355.   end
  356.    
  357. end
  358.  
  359. #==============================================================================
  360. # ** Sprite_OpenAnimation
  361. #==============================================================================
  362.  
  363. class Sprite_OpenAnimation < Sprite
  364.   #--------------------------------------------------------------------------
  365.   # * Initialize
  366.   #--------------------------------------------------------------------------
  367.   def initialize(vport, msg_window)
  368.     super(vport)
  369.     @msg = msg_window
  370.     w = 12*5
  371.     h = 12
  372.     self.bitmap = Bitmap.new(w,h)
  373.     bitmap.border_fill(Theo::Msg::OpeningColor)
  374.     self.ox = width/2
  375.     self.oy = height/2
  376.     update
  377.   end
  378.  
  379.   #--------------------------------------------------------------------------
  380.   # * Update
  381.   #--------------------------------------------------------------------------
  382.   def update
  383.     super
  384.     if Theo::Msg::UseOpening && @msg.balloon?
  385.       @ratio = @msg.openness / 255.0
  386.       self.opacity = @msg.openness
  387.       self.zoom_x = zoom_ratio_x
  388.       self.zoom_y = zoom_ratio_y
  389.       self.visible = false if @msg.open?
  390.     else
  391.       self.visible = false
  392.     end
  393.   end
  394.  
  395.   #--------------------------------------------------------------------------
  396.   # * Zoom ratio X
  397.   #--------------------------------------------------------------------------
  398.   def zoom_ratio_x
  399.     (@msg.width / width.to_f)* @ratio
  400.   end
  401.  
  402.   #--------------------------------------------------------------------------
  403.   # * Zoom ratio Y
  404.   #--------------------------------------------------------------------------
  405.   def zoom_ratio_y
  406.     (@msg.height / height.to_f) * @ratio
  407.   end
  408.  
  409.   #--------------------------------------------------------------------------
  410.   # * Start pop
  411.   #--------------------------------------------------------------------------
  412.   def start_pop(char)
  413.     Theo::Msg::OpeningSE.play if Theo::Msg::OpeningSE
  414.     self.x = char.x
  415.     self.y = char.y - 16
  416.     targ_x = @msg.x + @msg.width/2
  417.     targ_y = @msg.y + @msg.height/2
  418.     dur = 255/Theo::Msg::OpeningSpeed
  419.     goto(targ_x, targ_y, dur)
  420.   end
  421.  
  422. end
  423.  
  424. #==============================================================================
  425. # ** Window_Message
  426. #==============================================================================
  427.  
  428. class Window_Message < Window_Base
  429.   #--------------------------------------------------------------------------
  430.   # * Alias : Initialize
  431.   #--------------------------------------------------------------------------
  432.   alias theo_msgballoon_init initialize
  433.   def initialize
  434.     theo_msgballoon_init
  435.     @animation = Sprite_OpenAnimation.new(viewport, self)
  436.     @animation.visible = false
  437.     @pointer = BalloonPointer.new(viewport,self)
  438.   end
  439.  
  440.   #--------------------------------------------------------------------------
  441.   # * Alias clear instance variables
  442.   #--------------------------------------------------------------------------
  443.   alias theo_msgballoon_clear_instances clear_instance_variables
  444.   def clear_instance_variables
  445.     theo_msgballoon_clear_instances
  446.     @balloon = false
  447.     @subject = -1
  448.   end
  449.  
  450.   #--------------------------------------------------------------------------
  451.   # * Alias : Setting changed
  452.   #--------------------------------------------------------------------------
  453.   alias theo_msgballoon_settings_changed? settings_changed?
  454.   def settings_changed?
  455.     theo_msgballoon_settings_changed? || balloon_setting_changed?
  456.   end
  457.  
  458.   #--------------------------------------------------------------------------
  459.   # * Ballon setting changed
  460.   #--------------------------------------------------------------------------
  461.   def balloon_setting_changed?
  462.     @balloon != balloon? || @subject != $game_message.subject
  463.   end
  464.  
  465.   #--------------------------------------------------------------------------
  466.   # * Setup Window
  467.   #--------------------------------------------------------------------------
  468.   def setup_window
  469.     balloon? ? setup_balloon : setup_normal
  470.   end
  471.  
  472.   #--------------------------------------------------------------------------
  473.   # * Setup normal
  474.   #--------------------------------------------------------------------------
  475.   def setup_normal
  476.     h = fitting_height(visible_line_number)
  477.     w = Graphics.width
  478.     self.width = w
  479.     self.height = h
  480.     create_contents
  481.   end
  482.  
  483.   #--------------------------------------------------------------------------
  484.   # * Setup Balloon
  485.   #--------------------------------------------------------------------------
  486.   def setup_balloon
  487.     h = fitting_height($game_message.total_text) + 2
  488.     w = $game_message.longest_text + 10 + (standard_padding * 2)
  489.     self.width = w
  490.     self.height = h
  491.     create_contents
  492.     self.opacity = 255
  493.   end
  494.  
  495.   #--------------------------------------------------------------------------
  496.   # * Balloon mode?
  497.   #--------------------------------------------------------------------------
  498.   def balloon?
  499.     $game_message.balloon?
  500.   end
  501.  
  502.   #--------------------------------------------------------------------------
  503.   # * Update background
  504.   #--------------------------------------------------------------------------
  505.   alias theo_msgballoon_update_bg update_background
  506.   def update_background
  507.     recreate_choice if @balloon != balloon?
  508.     @balloon = balloon?
  509.     @subject = $game_message.subject
  510.     theo_msgballoon_update_bg
  511.   end
  512.  
  513.   #--------------------------------------------------------------------------
  514.   # * Update placement
  515.   #--------------------------------------------------------------------------
  516.   alias theo_msgballoon_normal_placement update_placement
  517.   def update_placement
  518.     setup_window
  519.     theo_msgballoon_normal_placement
  520.     if balloon?
  521.       update_balloon_placement
  522.     else
  523.       self.x = 0
  524.     end
  525.   end
  526.  
  527.   #--------------------------------------------------------------------------
  528.   # * Get character
  529.   #--------------------------------------------------------------------------
  530.   def char
  531.     $game_message.get_char
  532.   end
  533.  
  534.   #--------------------------------------------------------------------------
  535.   # * Update balloon placement
  536.   #--------------------------------------------------------------------------
  537.   def update_balloon_placement
  538.     xpos = [[char.x - width/2,0].max, Graphics.width - width].min
  539.     ypos = char.y - height - Theo::Msg::Buffer_Y
  540.     @pointer.pos = :upper
  541.     if ypos < 0
  542.       ypos = char.y + 11
  543.       @pointer.pos = :lower
  544.     end
  545.     self.x = xpos
  546.     self.y = ypos
  547.   end
  548.  
  549.   #--------------------------------------------------------------------------
  550.   # * Alias : New page
  551.   #--------------------------------------------------------------------------
  552.   alias theo_msgballoon_new_page new_page
  553.   def new_page(text, pos)
  554.     balloon? ? balloon_new_page(text, pos) : theo_msgballoon_new_page(text, pos)
  555.   end
  556.  
  557.   #--------------------------------------------------------------------------
  558.   # * Balloon new page
  559.   #--------------------------------------------------------------------------
  560.   def balloon_new_page(text, pos)
  561.     setup_balloon
  562.     update_balloon_placement
  563.     contents.clear
  564.     reset_font_settings
  565.     pos[:x] = new_line_x
  566.     pos[:y] = 0
  567.     pos[:new_x] = new_line_x
  568.     pos[:height] = calc_line_height(text)
  569.     clear_flags
  570.   end
  571.  
  572.   #--------------------------------------------------------------------------
  573.   # * Alias : New line X
  574.   #--------------------------------------------------------------------------
  575.   alias theo_balloon_new_line_x new_line_x
  576.   def new_line_x
  577.     balloon? ? 4 : theo_balloon_new_line_x
  578.   end
  579.  
  580.   #--------------------------------------------------------------------------
  581.   # * Alias : Update
  582.   #--------------------------------------------------------------------------
  583.   alias theo_msgballoon_update update
  584.   def update
  585.     theo_msgballoon_update
  586.     @pointer.update
  587.     @animation.update
  588.     if balloon?
  589.       self.visible = open? if Theo::Msg::UseOpening
  590.       update_balloon_placement if !@opening && !@closing
  591.     else
  592.       self.visible = true
  593.     end
  594.     recreate_choice if $game_message.balloon_refresh
  595.   end
  596.  
  597.   #--------------------------------------------------------------------------
  598.   # * Recreate choice
  599.   #--------------------------------------------------------------------------
  600.   def recreate_choice
  601.     @choice_window.dispose
  602.     @choice_window = Window_ChoiceList.new(self)
  603.     $game_message.balloon_refresh = false
  604.   end
  605.  
  606.   #--------------------------------------------------------------------------
  607.   # * Alias : Line height
  608.   #--------------------------------------------------------------------------
  609.   alias theo_msgballoon_line_height line_height
  610.   def line_height
  611.     balloon? ? Theo::Msg::FontSize : theo_msgballoon_line_height
  612.   end
  613.  
  614.   #--------------------------------------------------------------------------
  615.   # * Reset font settings
  616.   #--------------------------------------------------------------------------
  617.   alias theo_msgballoon_reset_font reset_font_settings
  618.   def reset_font_settings
  619.     theo_msgballoon_reset_font
  620.     contents.font.size = Theo::Msg::FontSize if balloon?
  621.   end
  622.  
  623.   #--------------------------------------------------------------------------
  624.   # * Overwrite : Input pause
  625.   #--------------------------------------------------------------------------
  626.   def input_pause
  627.     self.pause = true unless balloon?
  628.     wait(10)
  629.     Fiber.yield until Input.trigger?(:B) || Input.trigger?(:C)
  630.     Input.update
  631.     self.pause = false unless balloon?
  632.   end
  633.  
  634.   #--------------------------------------------------------------------------
  635.   # * Alias : Open and wait
  636.   #--------------------------------------------------------------------------
  637.   alias theo_msgballoon_open_wait open_and_wait
  638.   def open_and_wait
  639.     if balloon? && Theo::Msg::UseOpening
  640.       @animation.visible = true
  641.       @animation.start_pop(char)
  642.     end
  643.     theo_msgballoon_open_wait
  644.   end
  645.  
  646.   #--------------------------------------------------------------------------
  647.   # * Alias : Close and wait
  648.   #--------------------------------------------------------------------------
  649.   alias theo_msgballoon_close_wait close_and_wait
  650.   def close_and_wait
  651.     Theo::Msg::ClosingSE.play if Theo::Msg::UseOpening && Theo::Msg::ClosingSE
  652.     @animation.visible = false
  653.     theo_msgballoon_close_wait
  654.   end
  655.  
  656.   #--------------------------------------------------------------------------
  657.   # * Overwrite : Update Open Processing
  658.   #--------------------------------------------------------------------------
  659.   def update_open
  660.     speed = balloon? ? Theo::Msg::OpeningSpeed : 48
  661.     self.openness += speed
  662.     @opening = false if open?
  663.   end
  664.  
  665.   #--------------------------------------------------------------------------
  666.   # * Overwrite : Update Close Processing
  667.   #--------------------------------------------------------------------------
  668.   def update_close
  669.     speed = balloon? ? Theo::Msg::OpeningSpeed : 48
  670.     self.openness -= speed
  671.     @closing = false if close?
  672.   end
  673.  
  674.   #--------------------------------------------------------------------------
  675.   # * Alias : Convert escape character
  676.   #--------------------------------------------------------------------------
  677.   alias theo_msgballoon_convert_char convert_escape_characters
  678.   def convert_escape_characters(text)
  679.     result = theo_msgballoon_convert_char(text)
  680.     result = result.gsub(/<bm:\s*(\d+)>/i) { "" }
  681.     result
  682.   end
  683.  
  684.   #---------------------------------------------------------------------------
  685.   # * Alias : Dispose
  686.   #---------------------------------------------------------------------------
  687.   alias theo_msgballoon_dispose dispose
  688.   def dispose
  689.     theo_msgballoon_dispose
  690.     @animation.dispose
  691.     @pointer.dispose
  692.   end
  693.  
  694. end
  695.  
  696. #==============================================================================
  697. # ** Window_ChoiceList
  698. #==============================================================================
  699.  
  700. class Window_ChoiceList < Window_Command
  701.   #--------------------------------------------------------------------------
  702.   # * Reset font settings
  703.   #--------------------------------------------------------------------------
  704.   alias theo_msgballoon_reset_font reset_font_settings
  705.   def reset_font_settings
  706.     theo_msgballoon_reset_font
  707.     contents.font.size = Theo::Msg::FontSize if @message_window.balloon?
  708.   end
  709.  
  710.   #--------------------------------------------------------------------------
  711.   # * Alias : Update placement
  712.   #--------------------------------------------------------------------------
  713.   alias theo_msgballoon_update_placement update_placement
  714.   def update_placement
  715.     theo_msgballoon_update_placement
  716.     if @message_window.balloon?
  717.       update_balloon_placement
  718.     end
  719.   end
  720.  
  721.   #--------------------------------------------------------------------------
  722.   # * Update balloon placement
  723.   #--------------------------------------------------------------------------
  724.   def update_balloon_placement
  725.     msg = @message_window
  726.     self.y = msg.y
  727.     self.x = msg.x + msg.width
  728.     if (x + width) > Graphics.width
  729.       self.x = msg.x - width
  730.     end
  731.     if x < 0
  732.       self.x = msg.x + msg.width - self.width
  733.       self.y = msg.y + msg.height
  734.     end
  735.     if (y + height) > Graphics.height
  736.       self.y = msg.y - self.height
  737.     end
  738.   end
  739.  
  740.   #--------------------------------------------------------------------------
  741.   # * Alias : Line height
  742.   #--------------------------------------------------------------------------
  743.   alias theo_msgballoon_line_height line_height
  744.   def line_height
  745.     @message_window.balloon? ? Theo::Msg::FontSize : theo_msgballoon_line_height
  746.   end
  747.  
  748. end
  749.  
  750. #==============================================================================
  751. # ** Scene_Map
  752. #==============================================================================
  753. class Scene_Map
  754.  
  755.   #--------------------------------------------------------------------------
  756.   # * Alias : Post Transfer
  757.   #--------------------------------------------------------------------------
  758.   alias theo_msgballoon_post_transfer post_transfer
  759.   def post_transfer
  760.     theo_msgballoon_post_transfer
  761.     $game_message.subject = 0
  762.   end
  763.  
  764. end
Advertisement
Add Comment
Please, Sign In to add comment