vindaca510

V's Simple Face Replace v0.3

Sep 7th, 2013
396
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 8.98 KB | None | 0 0
  1. #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#
  2. #                                                                              #
  3. #                           V's Simple Face Replace                            #
  4. #                                 Version  0.3                                 #
  5. #                                                                              #
  6. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
  7. #                                Written By:  V                                #
  8. #                         Last Edited: October 6, 2013                         #
  9. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
  10. #                                                                              #
  11. #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#
  12.  
  13.  
  14. #==============================================================================#
  15. #------------------------------------------------------------------------------#
  16. # ** Disclaimer                                                                #
  17. #------------------------------------------------------------------------------#
  18. #                                                                              #
  19. # This script was intended for Non-commercial use only, if you wish to use     #
  20. # this script in a commercial game please PM me at which ever site you found   #
  21. # this script. Either way please give me credit in your game script as the     #
  22. # writer of this script, and send me a PM abuot the release of the game/demo.  #
  23. #                                                                              #
  24. #------------------------------------------------------------------------------#
  25. # ** How To Use                                                                #
  26. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
  27. #                                                                              #
  28. # * This script is pretty much plug-and-play.                                  #
  29. #                                                                              #
  30. # * You can adjust the x and y's for the menu actors below.                    #
  31. #                                                                              #
  32. # * To add the graphic to the message window use this command in a script      #
  33. #   call before the message is displayed.                                      #
  34. #                                                                              #
  35. #    set_message_graphic(graphic_page_name, graphic_index, x, y, zoom)         #
  36. #                                                                              #
  37. # * After the message use this in a script call to reset the graphic.          #
  38. #                                                                              #
  39. #    set_message_graphic                                                       #
  40. #                                                                              #
  41. #------------------------------------------------------------------------------#
  42. # ** Description                                                               #
  43. #------------------------------------------------------------------------------#
  44. #                                                                              #
  45. #  v0.1                                                                        #
  46. # ~=~=~=~                                                                      #
  47. #  * This script allows you to replace all of the faces in the game with the   #
  48. # actors graphics instead.                                                     #
  49. #                                                                              #
  50. #  v0.2                                                                        #
  51. # ~=~=~=~                                                                      #
  52. #  * I added a feature to change the face in the message windows to a graphic  #
  53. #  as well.                                                                    #
  54. #                                                                              #
  55. #  v0.3                                                                        #
  56. # ~=~=~=~                                                                      #
  57. #  * I added a zoom feature to change the graphic size in both the message     #
  58. #  windows and the menus.                                                      #
  59. #                                                                              #
  60. #------------------------------------------------------------------------------#
  61. #==============================================================================#
  62. module V_Simple_Face_Replace
  63.   module Specs
  64. #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#
  65. #                                                                              #
  66. #                           Start Customizable Area.                           #
  67. #                                                                              #
  68. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
  69. #                                                                              #
  70. #                      ONLY EDIT AFTER THE EQUALS SYMBOL.                      #
  71. #                                                                              #
  72. #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#
  73.    
  74.    
  75.   #============================================================================
  76.   #  Menu Options
  77.   #============================================================================
  78.    
  79.     Menu_Actor_Graphic_x = 50
  80.     Menu_Actor_Graphic_y = 50
  81.     Menu_Actor_Graphic_zoom = 1
  82.    
  83.    
  84.    
  85.    
  86.    
  87. #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#
  88. #                                                                              #
  89. #         DO NOT EDIT PAST THIS POINT UNLESS YOU KNOW WHAT YOUR DOING.         #
  90. #                                                                              #
  91. #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>#
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122. end
  123. end
  124. class Game_Message
  125.   attr_accessor :message_actor
  126.   attr_accessor :message_actor_index
  127.   attr_accessor :message_actor_x
  128.   attr_accessor :message_actor_y
  129.   attr_accessor :message_actor_zoom
  130.   alias :i0206165165132002 :initialize
  131.   def initialize
  132.     @message_actor = nil
  133.     @message_actor_index = nil
  134.     @message_actor_x = nil
  135.     @message_actor_y = nil
  136.     @message_actor_zoom = 1
  137.     i0206165165132002()
  138.   end
  139. end
  140. class Window_Base < Window
  141.   include V_Simple_Face_Replace::Specs
  142.   def draw_zoomed_character(character_name, character_index, x, y, zoom)
  143.     return unless character_name
  144.     bitmap = Cache.character(character_name)
  145.     sign = character_name[/^[\!\$]./]
  146.     if sign && sign.include?('$')
  147.       cw = bitmap.width / 3
  148.       ch = bitmap.height / 4
  149.     else
  150.       cw = bitmap.width / 12
  151.       ch = bitmap.height / 8
  152.     end
  153.     n = character_index
  154.     src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
  155.     actor = Rect.new(x, y, cw * zoom, ch * zoom)
  156.     contents.stretch_blt(actor, bitmap, src_rect)    
  157.   end
  158.   def draw_zoomed_actor_graphic(actor, x, y, zoom)
  159.     draw_zoomed_character(actor.character_name, actor.character_index, x, y, zoom)
  160.   end
  161.   def draw_actor_face(actor, x, y, enabled = true, zoom = Menu_Actor_Graphic_zoom)
  162.     if zoom == 1
  163.       draw_actor_graphic(actor, x + Menu_Actor_Graphic_x, y + Menu_Actor_Graphic_y)
  164.     else
  165.       draw_zoomed_actor_graphic(actor, x + Menu_Actor_Graphic_x, y + Menu_Actor_Graphic_y, Menu_Actor_Graphic_zoom)
  166.     end
  167.   end
  168. end
  169. class Window_Message < Window_Base
  170.   def new_page(text, pos)
  171.     actor = $game_message.message_actor
  172.     actor_index = $game_message.message_actor_index
  173.     x = $game_message.message_actor_x
  174.     y = $game_message.message_actor_y
  175.     zoom = $game_message.message_actor_zoom
  176.     contents.clear
  177.     if zoom == 1
  178.       draw_character(actor, actor_index, x, y) unless actor == nil || zoom > 1
  179.     else
  180.       draw_zoomed_character(actor, actor_index, x, y, zoom) unless actor == nil
  181.     end
  182.     reset_font_settings
  183.     pos[:x] = new_line_x
  184.     pos[:y] = 0
  185.     pos[:new_x] = new_line_x
  186.     pos[:height] = calc_line_height(text)
  187.     clear_flags
  188.   end
  189.   def new_line_x
  190.     $game_message.face_name.empty? ? check_for_message_graphic : 112
  191.   end
  192.   def check_for_message_graphic
  193.     $game_message.message_actor == nil ? 0 : 112
  194.   end
  195. end
  196. class Game_Interpreter
  197.   def set_message_graphic(graphic_page_name = nil, graphic_index = nil, x = nil, y = nil, zoom = 1)
  198.     $game_message.message_actor = graphic_page_name
  199.     $game_message.message_actor_index = graphic_index
  200.     $game_message.message_actor_x = x
  201.     $game_message.message_actor_y = y
  202.     $game_message.message_actor_zoom = zoom
  203.   end
  204. end
Advertisement
Add Comment
Please, Sign In to add comment