pigu_6

Galv| Menu Layout

Jan 21st, 2013
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.25 KB | None | 0 0
  1. #------------------------------------------------------------------------------#
  2. # Galv's Menu Layout
  3. #------------------------------------------------------------------------------#
  4. # For: RPGMAKER VX ACE
  5. # Version 1.4
  6. #------------------------------------------------------------------------------#
  7. # 2012-11-10 - Version 1.4 - Added option to set how many actors visible
  8. # 2012-10-19 - Version 1.3 - Fixed a bug that happened with lots of members
  9. # 2012-10-13 - Version 1.2 - Fixed to work in all screen resolutions with some
  10. # options to tweak position.
  11. # 2012-10-13 - Version 1.1 - Changed to use /Pictures/ instead of /Faces/
  12. # Seemed more appropriate as this would be used to
  13. # draw the image as a picture in game.
  14. # 2012-10-13 - Version 1.0 - release
  15. #------------------------------------------------------------------------------#
  16. # This script overwrites the default menu so the actors on the main menu screen
  17. # are lined up horizontally and display a portrait image instead of the face.
  18. #
  19. # INSTRUCTIONS:
  20. # Copy this script below materials and above main
  21. #
  22. # You MUST have a portrait for each actor. This was designed to work with
  23. # the RTP potraits that you must have purchased the right stuff to use.
  24. # These portrat images are around 270px x 290px.
  25.  
  26. # Put these portraits in the Graphics/pictures/ and name them the same as the
  27. # face graphic the actor uses, plus the position of the face in it.
  28. # For example
  29. # If your actor uses "Actor1" face and uses the first face in that file then
  30. # you will name the portrait image "Actor1-1.png"
  31. #
  32. # Download the demo if you don't understand
  33. #------------------------------------------------------------------------------#
  34.  
  35.  
  36. #------------------------------------------------------------------------------#
  37. # SCREEN SIZE
  38. #------------------------------------------------------------------------------#
  39. # This menu layout looks better on larger screen size. The below line
  40. # increases your screen size to the max. Remove it if you don't want this.
  41.  
  42. Graphics.resize_screen(640, 480)
  43.  
  44. #------------------------------------------------------------------------------#
  45. #------------------------------------------------------------------------------#
  46. module Galv_Menu
  47. #------------------------------------------------------------------------------#
  48. # SETUP OPTIONS
  49. #------------------------------------------------------------------------------#
  50.  
  51. CURRENCY_ICON = 361 # Icon to display instead of currency vocab.
  52. # Change this to 0 to use currency vocab instead.
  53.  
  54. PORTRAIT_X_OFFSET = 0 # add a positive or negative number to offset
  55. PORTRAIT_Y_OFFSET = 0 # each portrait's postion if the portraits you use
  56. # do not line up with your screen width/height.
  57.  
  58. PORTRAIT_HEIGHT = 400 # So you can tweak the height of the portraits.
  59.  
  60. NUMBER_OF_ACTORS = 4 # number of actors visible before scrolling (1 doesn't work)
  61.  
  62. #------------------------------------------------------------------------------#
  63. # END SETUP OPTIONS
  64. #------------------------------------------------------------------------------#
  65. end
  66.  
  67. class Window_MenuCommand < Window_Command
  68. def window_width
  69. return 130
  70. end
  71. end
  72.  
  73. class Window_Gold < Window_Base
  74. def window_width
  75. return 130
  76. end
  77. def refresh
  78. contents.clear
  79. if Galv_Menu::CURRENCY_ICON > 0
  80. draw_currency_value(value, currency_icon, 4, 0, contents.width - 25)
  81. else
  82. draw_currency_value(value, currency_unit, 4, 0, contents.width - 8)
  83. end
  84. end
  85. def currency_icon
  86. draw_icon(Galv_Menu::CURRENCY_ICON, contents.width - 23, -1, true)
  87. end
  88.  
  89. end
  90.  
  91.  
  92. class Window_MenuStatus < Window_Selectable
  93. def window_width
  94. Graphics.width - 130
  95. end
  96.  
  97. def item_height
  98. (height - standard_padding * 2)
  99. end
  100.  
  101. def draw_portrait(face_name, face_index, x, y, enabled = true)
  102. bitmap = Cache.picture(face_name + "-" + (face_index + 1).to_s)
  103. portrait_width = bitmap.width / 3 + Galv_Menu::PORTRAIT_X_OFFSET
  104. y_offset = Galv_Menu::PORTRAIT_Y_OFFSET
  105. rect = Rect.new(portrait_width, -70 + y_offset, col_width + tweak, Galv_Menu::PORTRAIT_HEIGHT)
  106. contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
  107. bitmap.dispose
  108. end
  109.  
  110. def tweak
  111. if Galv_Menu::NUMBER_OF_ACTORS <= 3
  112. return -2
  113. else
  114. return 0
  115. end
  116. end
  117.  
  118. def draw_actor_portrait(actor, x, y, enabled = true)
  119. draw_portrait(actor.face_name, actor.face_index, x, y, enabled)
  120. end
  121.  
  122. def draw_item(index)
  123. actor = $game_party.members[index]
  124. enabled = $game_party.battle_members.include?(actor)
  125. rect = item_rect(index)
  126. draw_item_background(index)
  127. draw_actor_portrait(actor, rect.x + 1, rect.y + 1, enabled)
  128. draw_actor_simple_status(actor, rect.x, rect.y)
  129. end
  130.  
  131. def draw_actor_simple_status(actor, x, y)
  132. draw_actor_name(actor, x, y)
  133. draw_actor_level(actor, x, y + line_height * 2)
  134. draw_actor_icons(actor, x, y + Graphics.height - line_height * 5)
  135. draw_actor_class(actor, x, y + line_height * 1)
  136. draw_actor_hp(actor, x, y + Graphics.height - line_height * 4)
  137. draw_actor_mp(actor, x, y + Graphics.height - line_height * 3)
  138. draw_actor_tp(actor, x, y + Graphics.height - line_height * 2)
  139. end
  140.  
  141. def col_width
  142. window_width / Galv_Menu::NUMBER_OF_ACTORS - standard_padding - 2
  143. end
  144.  
  145. def draw_actor_hp(actor, x, y, width = col_width)
  146. draw_gauge(x, y, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
  147. change_color(system_color)
  148. draw_text(x, y, 30, line_height, Vocab::hp_a)
  149. draw_current_and_max_values(x, y, width, actor.hp, actor.mhp,
  150. hp_color(actor), normal_color)
  151. end
  152.  
  153. def draw_actor_mp(actor, x, y, width = col_width)
  154. draw_gauge(x, y, width, actor.mp_rate, mp_gauge_color1, mp_gauge_color2)
  155. change_color(system_color)
  156. draw_text(x, y, 30, line_height, Vocab::mp_a)
  157. draw_current_and_max_values(x, y, width, actor.mp, actor.mmp,
  158. mp_color(actor), normal_color)
  159. end
  160.  
  161. def draw_actor_tp(actor, x, y, width = col_width)
  162. draw_gauge(x, y, width, actor.tp_rate, tp_gauge_color1, tp_gauge_color2)
  163. change_color(system_color)
  164. draw_text(x, y, 30, line_height, Vocab::tp_a)
  165. change_color(tp_color(actor))
  166. draw_text(x + width - 42, y, 42, line_height, actor.tp.to_i, 2)
  167. end
  168.  
  169.  
  170. def draw_current_and_max_values(x, y, width, current, max, color1, color2)
  171. change_color(color1)
  172. xr = x + width
  173. if width < 100
  174. draw_text(xr - 40, y, 42, line_height, current, 2)
  175. else
  176. draw_text(xr - 92, y, 42, line_height, current, 2)
  177. change_color(color2)
  178. draw_text(xr - 52, y, 12, line_height, "/", 2)
  179. draw_text(xr - 42, y, 42, line_height, max, 2)
  180. end
  181. end
  182. def draw_actor_name(actor, x, y, width = col_width)
  183. change_color(hp_color(actor))
  184. draw_text(x, y, width, line_height, actor.name)
  185. end
  186. def draw_actor_class(actor, x, y, width = col_width)
  187. change_color(normal_color)
  188. draw_text(x, y, width, line_height, actor.class.name)
  189. end
  190. def visible_line_number
  191. return 1
  192. end
  193. def col_max
  194. return Galv_Menu::NUMBER_OF_ACTORS
  195. end
  196. def spacing
  197. return 8
  198. end
  199. def contents_width
  200. (item_width + spacing) * item_max - spacing
  201. end
  202. def contents_height
  203. item_height
  204. end
  205. def top_col
  206. ox / (item_width + spacing)
  207. end
  208. def top_col=(col)
  209. col = 0 if col < 0
  210. @member_count = $game_party.members.count
  211. col = col_max + @member_count if col > col_max + @member_count
  212. self.ox = col * (item_width + spacing)
  213. end
  214. def bottom_col
  215. top_col + col_max - 1
  216. end
  217. def bottom_col=(col)
  218. self.top_col = col - (col_max - 1)
  219. end
  220. def ensure_cursor_visible
  221. self.top_col = index if index < top_col
  222. self.bottom_col = index if index > bottom_col
  223. end
  224. def item_rect(index)
  225. rect = super
  226. rect.x = index * (item_width + spacing)
  227. rect.y = 0
  228. rect
  229. end
  230. def alignment
  231. return 1
  232. end
  233. def cursor_down(wrap = false)
  234. end
  235. def cursor_up(wrap = false)
  236. end
  237. def cursor_pagedown
  238. end
  239. def cursor_pageup
  240. end
  241. end
Advertisement
Add Comment
Please, Sign In to add comment