Advertisement
CompanionWulf

Tweaks & Add-Ons (TWAXP) v1.0 - RGSS/RMXP

Jan 15th, 2015
518
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 60.51 KB | None | 0 0
  1. #==============================================================================
  2. # Tweaks & Add-Ons (TWAXP) v1.0
  3. #   Version      : 1.10.11.0
  4. #   Platform     : RMXP
  5. #   Author       : Companion Wulf
  6. #   Release Date : 23 July 2014
  7. #   Last Update  : 20 January 2015
  8. #   Websites     : RPG Maker Times          - http://blog.rpgmakertimes.info
  9. #                : Companion Blog           - http://rpgmakertimes.blogspot.com
  10. #                : Twitter                  - https://twitter.com/CompanionWulf
  11. #
  12. #------------------------------------------------------------------------------
  13. # * DESCRIPTION *
  14. #------------------------------------------------------------------------------
  15. #   This script adds several tweaks to RMXP, including layout.  It also adds
  16. #   some unavailable features and functions.
  17. #
  18. #------------------------------------------------------------------------------
  19. # * KNOWN COMPATABILITY ISSUES *
  20. #------------------------------------------------------------------------------
  21. #   A number of classes and class methods have been overwritten or modified,
  22. #   which may cause compatibility issues. These are:
  23. #
  24. #     ● Scene_Title - rewritten with sections put into separate blocks
  25. #     ● Window_Base - draw_actor_parameter, draw_actor_level
  26. #     ● Window_Status - separated into blocks for the various sections
  27. #
  28. #------------------------------------------------------------------------------
  29. # * REQUIRED SCRIPTS *
  30. #------------------------------------------------------------------------------
  31. #   A number of classes and class methods have been overwritten or modified,
  32. #   No other  scripts are required.  However, the following  modules/add-ons
  33. #   are recommended for additional effects (in order of installation):
  34. #
  35. #     ● Global Colors Module (GCM) – A module containing most of the standard
  36. #         colour codes, including variations  (converted to RGB format), con-
  37. #         veniently  named  for  easier  reference.  There are  presently 128
  38. #         colours to choose from, but you can add your own colours as well.
  39. #     ● Tweaks & Add-Ons  Script (TWAXP) – The main script  and its  settings
  40. #         for the TWAXP, and toggle options for its add-ons.
  41. #     ● Bitmap  Add-Ons (BMA) – An  addendum to the  Bitmap class,  providing
  42. #         additional  methods to  enhance it,  including  drawing titles  and
  43. #         shapes, such as circles and triangles.
  44. #
  45. #------------------------------------------------------------------------------
  46. # * TWEAKS & ADD-ONS VERSION HISTORY *
  47. #------------------------------------------------------------------------------
  48. # The version history tracking will be changing to the following format:
  49. #
  50. #     Release.Updates.Developmental.Manual
  51. #
  52. # Release numbers indicate public release versions.
  53. #
  54. # Updates refers to new scripts/scriptlets (major and minor updates).
  55. #
  56. # Developmental updates are for tweaks or bug fixes, and new added methods.
  57. #
  58. # Manual indicates major updates to the Tweaks & Add-Ons manual.
  59. #
  60. #------------------------------------------------------------------------------
  61. # * Updates Version History *
  62. #------------------------------------------------------------------------------
  63. # VERSION 2.0+ - Future Updates
  64. #   * Actor enhancements
  65. #   * Battle tweaks and add-ons
  66. #   * Confirm exit
  67. #   * Equipment screen expansion
  68. #   * Menu tweaks
  69. #   * Status add-ons
  70. #------------------------------------------------------------------------------
  71. # * Bugs To Fix *
  72. #------------------------------------------------------------------------------
  73. #   * Errors in displaying shadow and outline methods in Bitmap
  74. #------------------------------------------------------------------------------
  75. #
  76. # v1.10.11.0 (20-Jan-2015)
  77. #   ● Bug Fix: Incorrect Eva colour on Equip screen when stats change
  78. # v1.10.10.0 (03-Dec-2014)
  79. #   ● Add: New method to Window_Base - change_color (see Additional Notes below)
  80. #   ● Bug Fix: Skip Title not skipping (not perfect but functioning)
  81. # v1.9.9.0 (03-Oct-2014)
  82. #   ● Tweak: Currency alignment
  83. # v1.9.8.0 (28-Aug-2014)
  84. #   ● Tweak: XY offset coordinates for font shadow
  85. # v1.9.7.0 (18-Aug-2014)
  86. #   ● Bug Fix: Extra params incongruity on Equip screen
  87. #   ● Add: Comma delimiters for large gold amounts
  88. #   ● Add: Skip Title option
  89. # v1.7.6.0 (17-Aug-2014)
  90. #   ● Tweak: Change default windowskin
  91. # v1.7.5.0 (14-Aug-2014)
  92. #   ● Tweak: Colours for parameters increased/decreased with equip/unequip
  93. # v1.7.4.0 (11-Aug-2014)
  94. #   ● Bug Fix: Major error in Equip extra parameters tweak
  95. #   ● Tweak: Move extra font options to Bitmap Addons module
  96. #   ● Add: Bitmap Addons module (ported from RMVX) ¶ See Additional Notes below
  97. # v1.6.3.0 (10-Aug-2014)
  98. #   ● Add: Extra font options (shadow and outline)
  99. #   ● Add: Default font settings
  100. # v1.4.3.0 (04-Aug-2014)
  101. #   ● Add: Extra parameters to Equip screen
  102. # v1.3.3.0 (03-Aug-2014)
  103. #   ● Add: Class icons
  104. # v1.2.3.0 (28-Jul-2014)
  105. #   ● Add: States as icons
  106. #   ● Bug Fix: Error when health state actor.hp < 0 or negative
  107. #   ● Tweak: Health states colours
  108. #   ● Tweak: Status layout for items to fit more snugly
  109. # v1.1.0.0 (26-Jul-2014)
  110. #   ● Add: Health states
  111. # v1.0.0.0 (23-Jul-2014)
  112. #   ● Release: Version 1.0
  113. # v0.12.0.0 (22-Jul-2014)
  114. #   ● Add: Equipment parts
  115. #   ● Add: Hidden paremeters HIT and EVA to Status screen
  116. # v0.10.1.0 (21-Jul-2014)
  117. #   ● Add: Alternative parameter terms
  118. #   ● Add: Labels for Name and Class
  119. #   ● Began Status screen alternative layout
  120. # v0.7.0.0 (19-Jul-2014)
  121. #   ● Revamp Scene_Title for easier updates
  122. # v0.6.0.0 (17-Jul-2014)
  123. #   ● Add: Steps icon in Steps window
  124. #   ● Add: Play Time icon in Play Time window
  125. #   ● Add: Gold icon in Gold window
  126. #   ● Add: New method to Window_Base - draw_icon (see Additional Notes below)
  127. #   ● Add: Version number displayed on the Title screen
  128. #   ● Began working on tweaks and scripts
  129. #
  130. #------------------------------------------------------------------------------
  131. # Demo Version History
  132. #------------------------------------------------------------------------------
  133. #   v0.0       (Pending 2014) - Demo Public Release Version 1
  134. #==============================================================================
  135.  
  136. $imported = {} if $imported == nil; $imported["CW-TWAXP"] = true
  137.  
  138.  
  139. #===============================================================================
  140. # ** Tweaks & Add-Ons Settings **
  141. #===============================================================================
  142. module TWAXP_SETTINGS
  143.   include CW_GLOBAL_COLORS if $imported["CWColors"]
  144.   #============================================================================
  145.   # ** CONFIGURATION **
  146.   #----------------------------------------------------------------------------
  147.   # All of the options below are configurable. There shouldn't be any need to
  148.   # modify anything else, as they're all plug-and-play. Most of the settings are
  149.   # set to "true" by default.
  150.   #
  151.   # "true" toggles the setting on; "false" toggles it off.
  152.   #
  153.   # Note: Options remarked with #~ are not yet available but may be in a future
  154.   # version.
  155.   #
  156.   #============================================================================
  157.  
  158.   #============================================================================
  159.   # ** COLOUR SETTINGS **
  160.   #----------------------------------------------------------------------------
  161.   #     These predefine several colours. If the Global Colors Module (GCM) is
  162.   #     installed these will override the colours in the GCM. To use the GCM
  163.   #     instead of these colours, remark each colour out with a #.
  164.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  165.   BLACK  = Color.new(  0,  0,  0)
  166.   BLUE   = Color.new(  0,  0,255)
  167.   GREEN  = Color.new(  0,255,  0)
  168.   RED    = Color.new(255,  0,  0)
  169.   WHITE  = Color.new(255,255,255)
  170.   YELLOW = Color.new(255,255,  0)
  171.  
  172.   #============================================================================
  173.   # ** FONT SETTINGS **
  174.   #     These options define fonts, font size, etc. Colour constants are
  175.   #     predefined in the Global Colours Module (if installed) or under the
  176.   #     COLORS section at the top of the settings. Add your own using the same
  177.   #     format or define the colours manually.
  178.   #
  179.   #     Note: At present the shadow and outline don't work. This will be fixed
  180.   #     properly in a later version.
  181.   #----------------------------------------------------------------------------
  182.   # * Fonts
  183.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  184.   DEFAULT_FONT = "Arial"              # Display default font
  185.   DEFAULT_SIZE = 14                   # Display default font size
  186.   DEFAULT_COLOR = WHITE               # Display default font colour
  187.   #----------------------------------------------------------------------------
  188.   # * Titles
  189.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  190.   DEFAULT_TITLE_FONT = "Verdana"      # Display default title font
  191.   DEFAULT_TITLE_COLOR = YELLOW        # Display default title size
  192.   DEFAULT_TITLE_SIZE = 22             # Display default title colour
  193.   #----------------------------------------------------------------------------
  194.   # * Font Properties
  195.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  196.   DEFAULT_BOLD = false                # Display bold font by default
  197.   DEFAULT_ITALIC = false              # Display italic font by default
  198.   #----------------------------------------------------------------------------
  199.   # * Font Effects: Text Shadow
  200.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  201.   DEFAULT_SHADOW = true               # Display font shadow
  202.   DEFAULT_SHADOW_COLOR = WHITE        # Default font shadow colour
  203.   SHADOW_X_OFFSET = 1                 # Shadow X offset
  204.   SHADOW_Y_OFFSET = 4                 # Shadow Y offset
  205.   #----------------------------------------------------------------------------
  206.   # * Font Effects: Text Outline
  207.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  208.   DEFAULT_OUTLINE = true              # Display font outline
  209.   DEFAULT_OUTLINE_COLOR = BLACK       # Display font outline colour
  210.   #----------------------------------------------------------------------------
  211.   # * Windowskins
  212.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  213.   DEFAULT_WINDOWSKIN = "001-Blue01"   # Change default windowskin
  214.   #----------------------------------------------------------------------------
  215.   # * Line Settings
  216.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  217.   LINE_COLOR = WHITE                  # Line color for horizontal/vertical lines
  218.   #============================================================================
  219.  
  220.   #============================================================================
  221.   # ** TITLE SCREEN OPTIONS **
  222.   #----------------------------------------------------------------------------
  223.   #     These options are mainly for the Title screen, including menu options.
  224.   #----------------------------------------------------------------------------
  225.   # * Version Number
  226.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  227.   SHOW_VERSION = true                 # Display version number on Title screen
  228.     VERSION_ID = "1.9.9.0"            # Current version number of the game
  229.     VERSION_WINDOW_X = 500            # X-position of the Version window
  230.     VERSION_WINDOW_Y = 0              # Y-position of the Version window
  231.     VERSION_WINDOW_OPACITY = 0        # Opacity of the Version window
  232.   SKIP_TITLE = true                   # Skip the Title screen
  233.   #============================================================================
  234.  
  235.   #============================================================================
  236.   # ** GOLD WINDOW OPTIONS **
  237.   #----------------------------------------------------------------------------
  238.   #     The Gold Window Options tweak the gold display window.
  239.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  240.   SHOW_GOLD_ICON = true               # Show icons next to gold text
  241.     GOLD_ICON = "032-Item01"          # Name of gold icon to display
  242.   GOLD_COMMAS = true                  # Add commas to larger numbers in gold
  243.   CURRENCY_ALIGN = "Left"             # Align currency symbol left/right
  244.   #============================================================================
  245.    
  246.   #============================================================================
  247.   # ** PLAY TIME WINDOW OPTIONS **
  248.   #----------------------------------------------------------------------------
  249.   #     The Play Time Window Options tweak the play time display window.
  250.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  251.   SHOW_TIME_ICON = true               # Show icons next to play time text
  252.     TIME_ICON = "033-Item02"          # Name of time icon to display
  253.   #============================================================================
  254.  
  255.   #============================================================================
  256.   # ** STEPS WINDOW OPTIONS **
  257.   #----------------------------------------------------------------------------
  258.   #     The Steps Window Options tweak the steps display window.
  259.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  260.   SHOW_STEPS_ICON = true               # Show icons next to steps text
  261.     STEPS_ICON = "020-Accessory05"     # Name of steps icon to display
  262.   #============================================================================
  263.  
  264.   #============================================================================
  265.   # ** ALTERNATIVE STATUS ADD-ON OPTIONS **
  266.   #----------------------------------------------------------------------------
  267.   #     This changes the default Status screen layout to something much more
  268.   #     aesthetic. Each section has different styles and options.
  269.   #----------------------------------------------------------------------------
  270.   # * Toggle Layout Style *
  271.   #----------------------------------------------------------------------------
  272.   #     Options are "true" for an alternative aesthetic Status layout or "false"
  273.   #     to keep the default layout.
  274.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  275.   TOGGLE_STYLE = true                  # Toggle layout style
  276.     TOGGLE_LABELS = true               # Add labels to Name/Class
  277.   #----------------------------------------------------------------------------
  278.   # * Experience Text *
  279.   #----------------------------------------------------------------------------
  280.   #     Set the text for the Experience section. Set the strings to "*" to keep
  281.   #     the default values defined in the Database.
  282.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  283.   LVL = "Level"                       # Text for level
  284.   EXP = "Experience"                  # Text for exp
  285.   EXP_NEXT = "To Next Level"          # Text for next level exp
  286.   #----------------------------------------------------------------------------
  287.   # * Parameters Text *
  288.   #----------------------------------------------------------------------------
  289.   #     Set the text for the Parameters section. This overrides the defaults set
  290.   #     in the Database. Set the parameter strings to "*" to keep the default
  291.   #     values defined in the Database. Note: The last two in the array for HIT
  292.   #     and EVA are "hidden" parameters, so are not set in the Database. If
  293.   #     these are set to "*" the string in the array will be used instead.
  294.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  295.   #         Atk, Pdef, Mdef, Str, Dex, Agi, Int, Hit, Eva
  296.   PARAMS = ["Attack", "Phys. Def.", "Mag. Def.", "Strength", "Dexterity",
  297.             "Agility", "Intelligence", "Evasion", "Hit Rate"]
  298.     SHOW_EXTRA_PARAMS = true          # Show/hide extra parameters (HIT and EVA)
  299.   #----------------------------------------------------------------------------
  300.   # * Equipment Text *
  301.   #----------------------------------------------------------------------------
  302.   #     Set the text for the Equipment section.
  303.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  304.   EQUIP = "Equipment"                 # Text for equipment section
  305.     SHOW_EQUIP_PARTS = true           # Show/hide equipment parts
  306.     # Equipment parts array list
  307.     EQUIP_PARTS = ["Weapon", "Offhand", "Head", "Body"]
  308.   #----------------------------------------------------------------------------
  309.   # * Health Conditions Text *
  310.   #----------------------------------------------------------------------------
  311.   #     Provides a description of characters' health states. This is based on
  312.   #     a percentage range of their HP.
  313.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  314.   SHOW_HEALTH_STATES = true           # Enable/disable health states
  315.     HEALTH_STATES = [                 # Text for health states
  316.       "Dead",                         # When HP is 0%
  317.       "Full Health",                  # When HP is at 100%
  318.       "Healthy",                      # When HP is 75%-99%
  319.       "Injured",                      # When HP is 50%-74%
  320.       "Heavily Injured",              # When HP is 25%-49%
  321.       "Critical",                     # When HP is 1%-24%
  322.       "Barely Conscious",             # When HP is 1 after knockout
  323.     ]
  324.   #----------------------------------------------------------------------------
  325.   # * States As Icons *
  326.   #----------------------------------------------------------------------------
  327.   #     Displays states as icons instead of the default text. Note: Icons for
  328.   #     each state must exist in Graphics/Icons, named the same as the state in
  329.   #     the Database.
  330.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  331.   SHOW_STATES_ICONS = true            # Show/hide states as icons
  332.     MAX_STATES = 16                   # Maximum number of states displayed
  333.   #----------------------------------------------------------------------------
  334.   # * Class Icons *
  335.   #----------------------------------------------------------------------------
  336.   #     This array defines the icons used for each class, based on the class IDs
  337.   #     defined in the database. These are the icon filenames located in the
  338.   #     Graphics/Icons folder. Change/add as necessary for each class.
  339.   #
  340.   #     The CLASS_ICONS represent the same classes in the order they appear in
  341.   #     the Database.
  342.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  343.   SHOW_CLASS_ICONS = true
  344.     CLASS_ICONS = ["001-Weapon01", "002-Weapon02", "003-Weapon03",
  345.                    "004-Weapon04", "005-Weapon05", "006-Weapon06",
  346.                    "007-Weapon07", "008-Weapon08"]
  347.   #----------------------------------------------------------------------------
  348.   # * Status Screen Options **
  349.   #----------------------------------------------------------------------------
  350.   #     This section offers additional features to the Status Screen, including
  351.   #     an alternative layout.
  352.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  353.   TOGGLE_SECTION_TITLES = true        # Toggle section titles
  354.   #============================================================================
  355.  
  356.   #============================================================================
  357.   # ** EQUIP SCREEN ADD-ON OPTIONS **
  358.   #----------------------------------------------------------------------------
  359.   #     This add-on enhances the Equip screen, including additional features.
  360.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  361.   TOGGLE_EXTRA_EQUIP = true            # Toggle Equip screen extras
  362.   #  TOGGLE_LABELS = true               # Add labels to Name/Class
  363.   #============================================================================
  364.  
  365.   #============================================================================
  366.   # ** COMBAT ADD-ON OPTIONS **
  367.   #----------------------------------------------------------------------------
  368.   #     This add-on tweaks or enhances  the battle scenes,  including adding or
  369.   #     disabling options.
  370.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  371.  
  372.  
  373.   #============================================================================
  374.   # ** ADDITIONAL NOTES **
  375.   #     These are some notes on the various scripts/scriptlets and add-ons in
  376.   #     the Tweaks & Add-Ons script. Some are instructions of use for certain
  377.   #     new methods or additions.
  378.   #----------------------------------------------------------------------------
  379.   # * Icons *
  380.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  381.   #     All icons are imported into the Graphics/Icons folder.
  382.   #
  383.   #----------------------------------------------------------------------------
  384.   # * New Method: Draw Icon *
  385.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  386.   #     A new method - draw_icon - has been added to Window_Base. This enables
  387.   #     icons to be drawn easily in windows.
  388.   #
  389.   #     The formula is:
  390.   #
  391.   #         draw_icon(icon, x, y)
  392.   #
  393.   #     where "icon" is the name of the icon (filename without the extension);
  394.   #     "x" and "y" are the x- and y-coordinates of the icon.
  395.   #
  396.   #----------------------------------------------------------------------------
  397.   # * New Method: Change Color *
  398.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  399.   #     The new change_color method has been added to Window_Base, which allows
  400.   #     for an easier, much better method of changing colours than the default
  401.   #     self.contents.font.color.
  402.   #
  403.   #     The formula is:
  404.   #
  405.   #         change_color(color, alpha)
  406.   #
  407.   #     where "color" is a colour in any format (variable, constant, Color.new,
  408.   #     etc.) and "alpha" sets the colour's transparency ("true" by default).
  409.   #
  410.   #----------------------------------------------------------------------------
  411.   # * Bitmap Addons *
  412.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  413.   #     In the Bitmap Addons module included in this script, which has been
  414.   #     ported over from the RMVX version I did, are several additional
  415.   #     features and functions.
  416.   #
  417.   #     The following only outlines the added functions and their formulae, but
  418.   #     not how to use them. In the manual, these will be explained in greater
  419.   #     details, along with examples of use.
  420.   #
  421.   #   ● Reset Fonts             - Resets font settings to default
  422.   #   ● Draw Horizontal Line    - Draw a horizontal separator line
  423.   #   ● Draw Vertical Line      - Draw a vertical separator line
  424.   #   ● Draw Title              - Emphasize text as a title (with underline)
  425.   #   ● Draw Shadow Effect      - Enhancement on default shadow setting
  426.   #   ● Draw Outline Effect     - Draw text outline
  427.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  428.   #
  429.   #============================================================================
  430. end
  431.  
  432. #==============================================================================
  433. # ** CW's Bitmap Addons for TWAXP
  434. #   Version     : 1.3
  435. #   Platform    : RMXP
  436. #   Author      : Companion Wulf
  437. #   Release Date: 18 June 2010
  438. #   Last Update : 20 November 2013
  439. #   Websites    : RPG Maker Times - http://rpgmakertimes.blogspot.com
  440. #               : RMT Companion Blog - http://blog.rpgmakertimes.info
  441. #               : RPG Maker Times Facebook - http://facebook.com/RPGMakerTimes
  442. #------------------------------------------------------------------------------
  443. # This adds additional functions to the Bitmap class, including various text
  444. # options and shapes.
  445. #
  446. #------------------------------------------------------------------------------
  447. # * Features
  448. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  449. #   ● Reset Fonts             - Resets font settings to default
  450. #   ● Draw Horizontal Line    - Draw a horizontal separator line
  451. #   ● Draw Vertical Line      - Draw a vertical separator line
  452. #   ● Draw Title              - Emphasize text as a title (with underline)
  453. #   ● Draw Labels             - Emboldened text for text labels
  454. #
  455. # The following don't work properly, but will be full integrated into the
  456. # Bitmap at some point in the future.
  457. #   ● Draw Shadow Effect      - Enhancement on default shadow setting
  458. #   ● Draw Outline Effect     - Draw text outline
  459. #
  460. #------------------------------------------------------------------------------
  461. # * Version History
  462. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  463. # The version history tracking will be changing to the following format:
  464. #
  465. #     Release.Updates
  466. #
  467. # Release numbers indicate public release versions.
  468. #
  469. # Updates refers to new methods that have been added.
  470. #
  471. #------------------------------------------------------------------------------
  472. # Updates Version History
  473. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  474. # Prior to Version 1.0, dates for updates were not implemented.
  475. #
  476. #   v1.3 (29-Nov-2013)
  477. #     ● Reset Fonts
  478. #   v1.1 (13-Nov-2013)
  479. #     ● Draw Vertical Line
  480. #   v1.0 (18-Jun-2010)
  481. #     ● Release: Version 1.0
  482. #   v0.5
  483. #     ● Add: Draw Labels (draw_label)*
  484. #   v0.4
  485. #     ● Add: Draw Horizontal Line (draw_horz_line)*
  486. #   v0.3
  487. #     ● Add: Draw Font Shadow (draw_font_shadow)
  488. #   v0.2
  489. #     ● Add: Draw Font Outline (draw_font_outline)
  490. #   v0.1
  491. #     ● Add: Draw Title (draw_title)*
  492. #
  493. # * Originally created specifically for Extra Stats script for RMVX, but some
  494. #   features have been ported over to RMXP.
  495. #==============================================================================
  496. $imported = {} if $imported == nil; $imported["CWBitmapAddons"] = true
  497.  
  498. class Bitmap
  499.   include TWAXP_SETTINGS
  500.   #--------------------------------------------------------------------------
  501.   # * Reset Fonts To Defaults                                     |--ADDED--|
  502.   #--------------------------------------------------------------------------
  503.   def reset_fonts
  504.     self.font.default_name = DEFAULT_FONT
  505.     self.font.default_size = DEFAULT_SIZE
  506.     self.font.default_bold = false
  507.     self.font.default_italic = false
  508.     self.font.default_color = DEFAULT_COLOR
  509.   end
  510.   #--------------------------------------------------------------------------
  511.   # * Draw Horizontal Line                                        |--ADDED--|
  512.   #   x  : x-coordinate
  513.   #   y  : y-coordinate
  514.   #   lw : line width
  515.   #   lc : line colour
  516.   #   ls : line size (proportionate height)
  517.   #   lh : line height (textual)
  518.   #--------------------------------------------------------------------------
  519.   def draw_horz_line(x, y, lw = self.width, lc = LINE_COLOR, ls = 1, lh = 24)
  520.     line_y = y + lh / 2 + 10
  521.     self.fill_rect(x, line_y, lw-22, ls, lc)
  522.   end
  523.   #--------------------------------------------------------------------------
  524.   # * Draw Vertical Line                                          |--ADDED--|
  525.   #   x  : x-coordinate
  526.   #   y  : y-coordinate
  527.   #   lw : line width
  528.   #   lh : line height
  529.   #   lc : line colour
  530.   #--------------------------------------------------------------------------
  531.   def draw_vert_line(x, y, lw = 2, lh = self.height, lc = LINE_COLOR)
  532.     line_y = y + 24 / 2 - 1
  533.     line_x = x + 24 / 2 - 1
  534.     fill_rect(x, y, lw, lh, lc)
  535.   end  
  536.   #--------------------------------------------------------------------------
  537.   # * Draw Title                                                  |--ADDED--|
  538.   #     x    : window x-coordinate
  539.   #     y    : window y-coordinate
  540.   #     w    : window width
  541.   #     h    : window height
  542.   #     text : text to display
  543.   #     a    : text align
  544.   #--------------------------------------------------------------------------
  545.   def draw_title(x, y, title, w = self.width/2, h = 24, a = 0)
  546.     self.font.bold = true
  547.     self.font.name = DEFAULT_TITLE_FONT
  548.     self.font.color = DEFAULT_TITLE_COLOR
  549.     self.font.size  = DEFAULT_TITLE_SIZE
  550.     self.font.size  = 20
  551.     self.draw_text(x, y, w, h, title, a)
  552.     self.draw_horz_line(x, y + h * 0 + 9, w)
  553.     self.font.bold = false
  554.   end
  555.   #--------------------------------------------------------------------------
  556.   # * Draw Shadow                                                 |--ADDED--|
  557.   #     x    : draw spot x-coordinate
  558.   #     y    : draw spot y-coordinate
  559.   #     w    : width
  560.   #     h    : height
  561.   #     text : text to display
  562.   #--------------------------------------------------------------------------
  563.   def draw_font_shadow(x=0, y=0, text="", w=120, h=32)
  564.     # Display shadow/shadow color
  565.     self.font.color = DEFAULT_SHADOW_COLOR
  566.     self.draw_text(x + SHADOW_X_OFFSET, y + SHADOW_Y_OFFSET, w, h, text, 1)
  567.     # Display normal color text
  568.     self.font.color = DEFAULT_COLOR
  569.     self.draw_text(x, y, w, h, text)
  570.   end
  571.   #--------------------------------------------------------------------------
  572.   # * Draw Outline                                                |--ADDED--|
  573.   #     x    : draw spot x-coordinate
  574.   #     y    : draw spot y-coordinate
  575.   #     w    : width
  576.   #     h    : height
  577.   #     text : text to display
  578.   #--------------------------------------------------------------------------
  579.   def draw_font_outline(x=0, y=0, text="", w=120, h=32, a = 255)
  580.     self.font.color = DEFAULT_OUTLINE_COLOR
  581.     self.draw_text(x + 3, y * 32 + 3, w, h, text, 1)
  582.     self.draw_text(x - 3, y * 32 + 3, w, h, text, 1)
  583.     self.draw_text(x + 3, y * 32 - 3, w, h, text, 1)
  584.     self.draw_text(x - 3, y * 32 - 3, w, h, text, 1)
  585.     self.font.color = DEFAULT_COLOR
  586.     self.draw_text(x, y * 32, w, h, text, a)
  587.   end
  588. end
  589.  
  590. #==============================================================================
  591. # ** Window_Base
  592. #------------------------------------------------------------------------------
  593. # Added Methods
  594. #   * draw_icon
  595. # Aliased Methods
  596. #   * draw_actor_name
  597. #   * draw_actor_class
  598. # Overwritten Methods
  599. #   * draw_actorl_level
  600. #   * draw_actor_parameter
  601. #==============================================================================
  602.  
  603. class Window_Base < Window
  604.   include TWAXP_SETTINGS
  605.  
  606.   WLH = 32 # Line height constant
  607.  
  608.   #--------------------------------------------------------------------------
  609.   # * Object Initialization
  610.   #--------------------------------------------------------------------------
  611.   alias :cwtwaxp_winbs_initialize :initialize
  612.   def initialize(x, y, width, height)
  613.     cwtwaxp_winbs_initialize(x, y, width, height)
  614.     Font.default_name = DEFAULT_FONT
  615.     Font.default_size = DEFAULT_SIZE
  616.     Font.default_color = DEFAULT_COLOR
  617.     Font.default_bold = DEFAULT_BOLD
  618.     Font.default_italic = DEFAULT_ITALIC
  619.     self.contents = Bitmap.new(width - 32, height - 32)
  620.     $game_system.windowskin_name = DEFAULT_WINDOWSKIN
  621.     self.contents.draw_font_shadow if DEFAULT_SHADOW
  622.     self.contents.draw_font_outline if DEFAULT_OUTLINE
  623.   end
  624.   #--------------------------------------------------------------------------
  625.   # * Change Text Drawing Color
  626.   #     enabled : Enabled flag. When false, draw semi-transparently.
  627.   #--------------------------------------------------------------------------
  628.   def change_color(color, enabled = true)
  629.     contents.font.color = color
  630.     contents.font.color.alpha = translucent_alpha unless enabled
  631.   end
  632.   #--------------------------------------------------------------------------
  633.   # * Draw Icon
  634.   #     icon  : Name of icon
  635.   #     x     : Icon x-coordinate
  636.   #     y     : Icon y-coordinate
  637.   #--------------------------------------------------------------------------
  638.   def draw_icon(icon, x, y)
  639.     bitmap = RPG::Cache.icon(icon)
  640.     sw = bitmap.width
  641.     sh = bitmap.height
  642.     src_rect = Rect.new(0, 0, sw, sh)
  643.     self.contents.blt(x, y, bitmap, src_rect)
  644.   end
  645.   #--------------------------------------------------------------------------
  646.   # * Draw Name
  647.   #--------------------------------------------------------------------------
  648.   alias :cwtwaxp_winbs_draw_name :draw_actor_name
  649.   def draw_actor_name(actor, x, y)
  650.     if TOGGLE_LABELS
  651.       self.contents.font.color = system_color
  652.       self.contents.draw_text(x, y, 60, WLH, "Name:")
  653.       x += 60
  654.     end
  655.     cwtwaxp_winbs_draw_name(actor, x, y)
  656.   end
  657.  
  658.   #--------------------------------------------------------------------------
  659.   # * Draw Class
  660.   #--------------------------------------------------------------------------
  661.   alias :cwtwaxp_winbs_draw_class :draw_actor_class
  662.   def draw_actor_class(actor, x, y)
  663.     if TOGGLE_LABELS
  664.       self.contents.font.color = system_color
  665.       self.contents.draw_text(x + 80, y, 60, WLH, "Class:")
  666.       x += 60
  667.     end
  668.     if SHOW_CLASS_ICONS
  669.       class_icon = actor.class_id - 1
  670.       draw_icon(CLASS_ICONS[class_icon], x + 72, y)
  671.       x += 32
  672.     end
  673.     cwtwaxp_winbs_draw_class(actor, x + 80, y)
  674.   end
  675.  
  676.   #--------------------------------------------------------------------------
  677.   # * Draw Level
  678.   #--------------------------------------------------------------------------
  679.   def draw_actor_level(actor, x, y)
  680.     LVL == "*" ? lvl = "Lv" : lvl = LVL
  681.     self.contents.font.color = system_color
  682.     self.contents.draw_text(x, y, 60, WLH, lvl)
  683.     self.contents.font.color = normal_color
  684.     self.contents.draw_text(x + 55, y, 24, WLH, actor.level.to_s, 2)
  685.   end
  686.  
  687.   #--------------------------------------------------------------------------
  688.   # * Draw Parameter
  689.   #--------------------------------------------------------------------------
  690.   def draw_actor_parameter(actor, x, y, type)
  691.     case type
  692.     when 0
  693.       PARAMS[0] == "*" ? pname = $data_system.words.atk : pname = PARAMS[0]
  694.       parameter_value = actor.atk
  695.     when 1
  696.       PARAMS[1] == "*" ? pname = $data_system.words.pdef : pname = PARAMS[1]
  697.       parameter_value = actor.pdef
  698.     when 2
  699.       PARAMS[2] == "*" ? pname = $data_system.words.mdef : pname = PARAMS[2]
  700.       parameter_value = actor.mdef
  701.     when 3
  702.       PARAMS[3] == "*" ? pname = $data_system.words.str : pname = PARAMS[3]
  703.       parameter_value = actor.str
  704.     when 4
  705.       PARAMS[4] == "*" ? pname = $data_system.words.dex : pname = PARAMS[4]
  706.       parameter_value = actor.dex
  707.     when 5
  708.       PARAMS[5] == "*" ? pname = $data_system.words.agi : pname = PARAMS[5]
  709.       parameter_value = actor.agi
  710.     when 6
  711.       PARAMS[6] == "*" ? pname = $data_system.words.int : pname = PARAMS[6]
  712.       parameter_value = actor.int
  713.     when 7
  714.       pname = PARAMS[7]
  715.       parameter_value = actor.eva
  716.     when 8
  717.       pname = PARAMS[8]
  718.       parameter_value = actor.hit
  719.     end
  720.     self.contents.font.color = system_color
  721.     self.contents.draw_text(x, y, 120, WLH, pname)
  722.     self.contents.font.color = normal_color
  723.     self.contents.draw_text(x + 120, y, 36, WLH, parameter_value.to_s, 2)
  724.   end
  725.   #--------------------------------------------------------------------------
  726.   # * Draw HP
  727.   #     actor : actor
  728.   #     x     : draw spot x-coordinate
  729.   #     y     : draw spot y-coordinate
  730.   #     width : draw spot width
  731.   #--------------------------------------------------------------------------
  732.   alias :cwtwaxp_winbs_draw_hp :draw_actor_hp
  733.   def draw_actor_hp(actor, x, y, width = 144)
  734.     cwtwaxp_winbs_draw_hp(actor, x, y, width)
  735.     if SHOW_HEALTH_STATES
  736.       color = normal_color
  737.       if actor.hp == 0 || actor.hp < 0
  738.         health = HEALTH_STATES[0]; color = knockout_color
  739.       elsif actor.hp == actor.maxhp
  740.         health = HEALTH_STATES[1]
  741.       elsif actor.hp >= (0.75*actor.maxhp) && actor.hp <= (0.99*actor.maxhp)
  742.         health = HEALTH_STATES[2]
  743.       elsif actor.hp >= (0.50*actor.maxhp) && actor.hp <= (0.74*actor.maxhp)
  744.         health = HEALTH_STATES[3]
  745.       elsif actor.hp >= (0.25*actor.maxhp) && actor.hp <= (0.49*actor.maxhp)
  746.         health = HEALTH_STATES[4]
  747.       elsif actor.hp >= (0.01*actor.maxhp) && actor.hp <= (0.24*actor.maxhp)
  748.         health = HEALTH_STATES[5]
  749.       else
  750.         health = HEALTH_STATES[6]; color = knockout_color
  751.       end
  752.       color = crisis_color if health == HEALTH_STATES[5]
  753.       self.contents.font.color = color
  754.       self.contents.draw_text(x + 260, y + WLH * 4, 220, WLH, health, 0)
  755.     end
  756.   end
  757.   #--------------------------------------------------------------------------
  758.   # * Draw State
  759.   #     actor : actor
  760.   #     x     : draw spot x-coordinate
  761.   #     y     : draw spot y-coordinate
  762.   #     width : draw spot width
  763.   #--------------------------------------------------------------------------
  764.   alias :cwtwaxp_draw_state :draw_actor_state
  765.   def draw_actor_state(actor, x, y, width = 120)
  766.     if SHOW_STATES_ICONS
  767.       for i in 0...actor.states.length
  768.         if i < MAX_STATES
  769.           ix = 24 * i
  770.           draw_icon($data_states[actor.states[i]].name, x + ix, y + 8)
  771.         end
  772.       end
  773.     else
  774.       cwtwaxp_draw_state(actor, x, y, width)
  775.     end
  776.   end  
  777.  
  778. end
  779.  
  780. #==============================================================================
  781. # ** Scene_Title
  782. #------------------------------------------------------------------------------
  783. # # Added Methods
  784. #               * load_database
  785. #               * create_game_objects
  786. #               * create_title_graphic
  787. #               * create_commands
  788. #   * check_continue
  789. #               * play_title_music
  790. #               * terminate
  791. #               * create_version_window
  792. # Aliased Methods
  793. #   *
  794. # Overwritten Methods
  795. #   * main
  796.  
  797. #==============================================================================
  798.  
  799. class Scene_Title
  800.   include TWAXP_SETTINGS
  801.   #--------------------------------------------------------------------------
  802.   # * Main Processing
  803.   #     The Main method has been rewritten to make it easier to reference and
  804.   #     alias.
  805.   #--------------------------------------------------------------------------
  806.   def main
  807.     # If battle test
  808.     if $BTEST
  809.       battle_test
  810.       return
  811.     end
  812.   # Start Processing
  813.     load_database
  814.     create_game_objects
  815.     skip_title_check
  816.     create_title_graphic
  817.     create_commands
  818.     play_title_music
  819.     # Version Window
  820.     create_version_window if SHOW_VERSION
  821.     # Execute transition
  822.     Graphics.transition
  823.     # Main loop
  824.     loop do
  825.       # Update game screen
  826.       Graphics.update
  827.       # Update input information
  828.       Input.update
  829.       # Frame update
  830.       update
  831.       # Abort loop if screen is changed
  832.       if $scene != self
  833.         break
  834.       end
  835.     end
  836.     terminate
  837.   end
  838.    
  839.   #--------------------------------------------------------------------------
  840.   # * Load Database
  841.   #--------------------------------------------------------------------------
  842.   def load_database
  843.     # Load database
  844.     $data_actors        = load_data("Data/Actors.rxdata")
  845.     $data_classes       = load_data("Data/Classes.rxdata")
  846.     $data_skills        = load_data("Data/Skills.rxdata")
  847.     $data_items         = load_data("Data/Items.rxdata")
  848.     $data_weapons       = load_data("Data/Weapons.rxdata")
  849.     $data_armors        = load_data("Data/Armors.rxdata")
  850.     $data_enemies       = load_data("Data/Enemies.rxdata")
  851.     $data_troops        = load_data("Data/Troops.rxdata")
  852.     $data_states        = load_data("Data/States.rxdata")
  853.     $data_animations    = load_data("Data/Animations.rxdata")
  854.     $data_tilesets      = load_data("Data/Tilesets.rxdata")
  855.     $data_common_events = load_data("Data/CommonEvents.rxdata")
  856.     $data_system        = load_data("Data/System.rxdata")
  857.   end
  858.   #--------------------------------------------------------------------------
  859.   # * Create Game Objects
  860.   #--------------------------------------------------------------------------
  861.   def create_game_objects
  862.     $game_temp          = Game_Temp.new
  863.     $game_system        = Game_System.new
  864.     $game_switches      = Game_Switches.new
  865.     $game_variables     = Game_Variables.new
  866.     $game_self_switches = Game_SelfSwitches.new
  867.     $game_screen        = Game_Screen.new
  868.     $game_actors        = Game_Actors.new
  869.     $game_party         = Game_Party.new
  870.     $game_troop         = Game_Troop.new
  871.     $game_map           = Game_Map.new
  872.     $game_player        = Game_Player.new
  873.     $game_system        = Game_System.new
  874.   end
  875.   #--------------------------------------------------------------------------
  876.   # * Create Title Graphic
  877.   #--------------------------------------------------------------------------
  878.   def create_title_graphic
  879.     # Make title graphic
  880.     @sprite = Sprite.new
  881.     @sprite.bitmap = RPG::Cache.title($data_system.title_name)
  882.   end
  883.   #--------------------------------------------------------------------------
  884.   # * Create Command Window
  885.   #--------------------------------------------------------------------------
  886.   def create_commands
  887.     # Make command window
  888.     s1 = "New Game"
  889.     s2 = "Continue"
  890.     s3 = "Shutdown"
  891.     @command_window = Window_Command.new(192, [s1, s2, s3])
  892.     @command_window.back_opacity = 160
  893.     @command_window.x = 320 - @command_window.width / 2
  894.     @command_window.y = 288
  895.     # Continue enabled determinant
  896.     check_continue unless SKIP_TITLE
  897.   end
  898.   #--------------------------------------------------------------------------
  899.   # * Check Continue
  900.   #--------------------------------------------------------------------------
  901.   def check_continue
  902.     # Check if at least one save file exists
  903.     # If enabled, make @continue_enabled true; if disabled, make it false
  904.     @continue_enabled = false
  905.     for i in 0..3
  906.       if FileTest.exist?("Save#{i+1}.rxdata")
  907.         @continue_enabled = true
  908.       end
  909.     end
  910.     # If continue is enabled, move cursor to "Continue"
  911.     # If disabled, display "Continue" text in gray
  912.     if @continue_enabled
  913.       @command_window.index = 1
  914.     else
  915.       @command_window.disable_item(1)
  916.     end
  917.   end
  918.   #--------------------------------------------------------------------------
  919.   # * Play Title Music
  920.   #--------------------------------------------------------------------------
  921.   def play_title_music
  922.     # Play title BGM
  923.     $game_system.bgm_play($data_system.title_bgm)
  924.     # Stop playing ME and BGS
  925.     Audio.me_stop
  926.     Audio.bgs_stop
  927.   end
  928.   #--------------------------------------------------------------------------
  929.   # * Terminate Processing
  930.   #--------------------------------------------------------------------------
  931.   def terminate
  932.     # Prepare for transition
  933.     Graphics.freeze
  934.     # Dispose of command window
  935.     @command_window.dispose
  936.     # Dispose of title graphic
  937.     @sprite.bitmap.dispose
  938.     @sprite.dispose
  939.     @version_window.dispose
  940.   end
  941.   #--------------------------------------------------------------------------
  942.   # * Create Version Window
  943.   #--------------------------------------------------------------------------
  944.   def create_version_window
  945.     if SHOW_VERSION
  946.       @version_window = Window_Version.new
  947.       @version_window.x = VERSION_WINDOW_X
  948.       @version_window.y = VERSION_WINDOW_Y
  949.     end
  950.   end
  951.  
  952.   def skip_title_check
  953.     if SKIP_TITLE
  954.       load_database
  955.       create_game_objects
  956.       command_new_game
  957.     end
  958.   end
  959. end
  960.  
  961. #==============================================================================
  962. # ** Window_Version
  963. #------------------------------------------------------------------------------
  964. #  This window displays the current version of the game.
  965. #==============================================================================
  966. class Window_Version < Window_Base
  967.   include TWAXP_SETTINGS
  968.   #--------------------------------------------------------------------------
  969.   # * Object Initialization
  970.   #     x : window X coordinate
  971.   #     y : window Y coordinate
  972.   #--------------------------------------------------------------------------
  973.   def initialize
  974.     super(0, 0, 160, WLH + 32)
  975.     self.contents = Bitmap.new(width - 32, height - 32)
  976.     self.opacity = VERSION_WINDOW_OPACITY
  977.     refresh
  978.   end
  979.   #--------------------------------------------------------------------------
  980.   # * Refresh
  981.   #--------------------------------------------------------------------------
  982.   def refresh
  983.     self.contents.clear
  984.     self.contents.font.size = DEFAULT_SIZE
  985.     self.contents.draw_text(0, 0, 160, WLH, "Version: " + VERSION_ID)
  986.   end
  987. end
  988.  
  989. #==============================================================================
  990. # ** Window_Gold
  991. #------------------------------------------------------------------------------
  992. #  This window displays amount of gold.
  993. #------------------------------------------------------------------------------
  994. # Overwritten Methods
  995. #   * refresh
  996.  
  997. #==============================================================================
  998.  
  999. class Window_Gold < Window_Base
  1000.   include TWAXP_SETTINGS
  1001.   #--------------------------------------------------------------------------
  1002.   # * Refresh
  1003.   #--------------------------------------------------------------------------
  1004.   def refresh
  1005.     self.contents.clear
  1006.     draw_icon(GOLD_ICON, 0, 0) if SHOW_GOLD_ICON
  1007.     cx = contents.text_size($data_system.words.gold).width
  1008.     GOLD_COMMAS ? gold = $game_party.gold.to_s.reverse.gsub(/(\d{3})(?=\d)/, '\\1,').reverse :
  1009.       gold = $game_party.gold.to_s
  1010.     self.contents.font.color = normal_color
  1011.     self.contents.draw_text(4, 0, 120-cx-2, 32, gold.to_s, 2)
  1012.     self.contents.font.color = system_color
  1013.     if CURRENCY_ALIGN.upcase == "LEFT"; x, align = 28, 0
  1014.     else x, align = 124-cx, 2; end
  1015.     self.contents.draw_text(x, 0, cx, 32, $data_system.words.gold, align)
  1016.   end
  1017. end
  1018.  
  1019. #==============================================================================
  1020. # ** Window_PlayTime
  1021. #------------------------------------------------------------------------------
  1022. #  This window displays play time on the menu screen.
  1023. #------------------------------------------------------------------------------
  1024. # Overwritten Methods
  1025. #   * refresh
  1026. #==============================================================================
  1027.  
  1028. class Window_PlayTime < Window_Base
  1029.   include TWAXP_SETTINGS
  1030.   #--------------------------------------------------------------------------
  1031.   # * Refresh
  1032.   #--------------------------------------------------------------------------
  1033.   def refresh
  1034.     self.contents.clear
  1035.     x, ptx = 4, 4
  1036.     if SHOW_TIME_ICON; draw_icon(TIME_ICON, 0, 0); x += 26; end
  1037.     self.contents.font.color = system_color
  1038.     self.contents.draw_text(x, 0, 120, 32, "Play Time")
  1039.     @total_sec = Graphics.frame_count / Graphics.frame_rate
  1040.     hour = @total_sec / 60 / 60
  1041.     min = @total_sec / 60 % 60
  1042.     sec = @total_sec % 60
  1043.     text = sprintf("%02d:%02d:%02d", hour, min, sec)
  1044.     self.contents.font.color = normal_color
  1045.     self.contents.draw_text(ptx, 32, 120, 32, text, 2) if SHOW_TIME_ICON
  1046.   end
  1047. end
  1048.  
  1049. #==============================================================================
  1050. # ** Window_Steps
  1051. #------------------------------------------------------------------------------
  1052. #  This window displays step count on the menu screen.
  1053. # Overwritten Methods
  1054. #   * refresh
  1055. #==============================================================================
  1056.  
  1057. class Window_Steps < Window_Base
  1058.   include TWAXP_SETTINGS
  1059.   #--------------------------------------------------------------------------
  1060.   # * Refresh
  1061.   #--------------------------------------------------------------------------
  1062.   def refresh
  1063.     self.contents.clear
  1064.     x, stx = 4, 4
  1065.     if SHOW_STEPS_ICON; draw_icon(STEPS_ICON, 0, 0); x += 26; end
  1066.     self.contents.font.color = system_color
  1067.     self.contents.draw_text(x, 0, 120, 32, "Step Count")
  1068.     self.contents.font.color = normal_color
  1069.     self.contents.draw_text(stx, 32, 120, 32, $game_party.steps.to_s, 2)
  1070.   end
  1071. end
  1072.  
  1073. #==============================================================================
  1074. # ** Window_Status
  1075. #------------------------------------------------------------------------------
  1076. #  This window displays full status specs on the status screen.
  1077. #------------------------------------------------------------------------------
  1078. # Added Methods
  1079. #               * draw_block1
  1080. #               * draw_block2
  1081. #               * draw_block3
  1082. #               * draw_block4
  1083. #               * draw_block5
  1084. # Aliased Methods
  1085. #               * refresh
  1086. # Overwritten Methods
  1087. #               *
  1088. #==============================================================================
  1089.  
  1090. class Window_Status < Window_Base
  1091.   include TWAXP_SETTINGS
  1092.   #--------------------------------------------------------------------------
  1093.   # * Refresh
  1094.   #--------------------------------------------------------------------------
  1095.   alias :cwtwaxp_winsts_refresh :refresh
  1096.   def refresh
  1097.     if TOGGLE_STYLE
  1098.       self.contents.clear
  1099.       self.contents.font.size = 18
  1100.       draw_block1(4, 0)       # Draw actor info
  1101.       draw_block2(320, 0)     # Draw exp info
  1102.       draw_block3(26)    # Draw parameters
  1103.       draw_block4     # Draw states
  1104.       draw_block5     # Draw equipment
  1105.     else
  1106.       cwtwaxp_winsts_refresh
  1107.     end
  1108.   end
  1109.   #--------------------------------------------------------------------------
  1110.   # * Block 1: Actor Info
  1111.   #--------------------------------------------------------------------------
  1112.   def draw_block1(x, y)
  1113.     draw_actor_graphic(@actor, 30, 112)
  1114.     draw_actor_name(@actor, 4, WLH * 0)
  1115.     draw_actor_class(@actor, 4 + 144, WLH * 0)
  1116.   end
  1117.  
  1118.   #--------------------------------------------------------------------------
  1119.   # * Block 2: Experience Info
  1120.   #--------------------------------------------------------------------------
  1121.   def draw_block2(x, y)
  1122.     if TOGGLE_SECTION_TITLES
  1123.       self.contents.draw_title(x, y + WLH * 1, "Experience")
  1124.       y += WLH
  1125.     end
  1126.     EXP == "*" ? exp = "EXP" : exp = EXP
  1127.     EXP_NEXT == "*" ? exp_next = "NEXT" : exp_next = EXP_NEXT
  1128.     draw_actor_level(@actor, x, y + WLH * 1)
  1129.     self.contents.font.color = system_color
  1130.     self.contents.draw_text(x, y + WLH * 2, self.width, WLH, exp)
  1131.     self.contents.draw_text(x, y + WLH * 3, self.width, WLH, exp_next)
  1132.     self.contents.font.color = normal_color
  1133.     self.contents.draw_text(x + 180, y + WLH * 2, 84, WLH, @actor.exp_s, 2)
  1134.     self.contents.draw_text(x + 180, y + WLH * 3, 84, WLH, @actor.next_rest_exp_s, 2)
  1135.   end
  1136.  
  1137.   #--------------------------------------------------------------------------
  1138.   # * Block 3: Parameters
  1139.   #--------------------------------------------------------------------------
  1140.   def draw_block3(x, y = 0)
  1141.     draw_actor_hp(@actor, x + 34, WLH * 1 + 14, 172)
  1142.     draw_actor_sp(@actor, x + 34, WLH * 2 + 14, 172)
  1143.     if TOGGLE_SECTION_TITLES
  1144.       self.contents.draw_title(x, y + WLH * 4, "Parameters")
  1145.       y += WLH
  1146.     end
  1147.     draw_actor_parameter(@actor, x, y + WLH * 4, 0)
  1148.     draw_actor_parameter(@actor, x, y + WLH * 5, 1)
  1149.     draw_actor_parameter(@actor, x, y + WLH * 6, 2)
  1150.     draw_actor_parameter(@actor, x, y + WLH * 7, 3)
  1151.     draw_actor_parameter(@actor, x, y + WLH * 8, 4)
  1152.     draw_actor_parameter(@actor, x, y + WLH * 9, 5)
  1153.     draw_actor_parameter(@actor, x, y + WLH * 10, 6)
  1154.     if SHOW_EXTRA_PARAMS
  1155.       draw_actor_parameter(@actor, x, y + WLH * 11, 7)
  1156.       draw_actor_parameter(@actor, x, y + WLH * 12, 8)
  1157.     end
  1158.   end
  1159.   #--------------------------------------------------------------------------
  1160.   # * Block 4: States
  1161.   #--------------------------------------------------------------------------
  1162.   def draw_block4
  1163.     draw_actor_state(@actor, 320, WLH * 5)
  1164.   end
  1165.   #--------------------------------------------------------------------------
  1166.   # * Block 5: Equipment
  1167.   #--------------------------------------------------------------------------
  1168.   def draw_block5
  1169.     EQUIP == "*" ? equip = "EQUIPMENT" : equip = EQUIP
  1170.     self.contents.font.color = system_color
  1171.     self.contents.draw_text(320, WLH * 7, self.width, 32, equip)
  1172.     x = 340
  1173.     if SHOW_EQUIP_PARTS
  1174.       for i in 0...EQUIP_PARTS.size
  1175.         y = i + 8
  1176.         self.contents.draw_text(x, WLH * y, 80, WLH, EQUIP_PARTS[i])
  1177.       end
  1178.       x += 80
  1179.     end
  1180.     draw_item_name($data_weapons[@actor.weapon_id], x + 16, WLH * 8)
  1181.     draw_item_name($data_armors[@actor.armor1_id], x + 16, WLH * 9)
  1182.     draw_item_name($data_armors[@actor.armor2_id], x + 16, WLH * 10)
  1183.     draw_item_name($data_armors[@actor.armor3_id], x + 16, WLH * 11)
  1184.     draw_item_name($data_armors[@actor.armor4_id], x + 16, WLH * 12)
  1185.   end
  1186.  
  1187. end
  1188.  
  1189. #==============================================================================
  1190. # ** Scene_Equip
  1191. #------------------------------------------------------------------------------
  1192. #  This class performs equipment screen processing.
  1193. #==============================================================================
  1194.  
  1195. class Scene_Equip
  1196.   include TWAXP_SETTINGS
  1197.   #--------------------------------------------------------------------------
  1198.   # * Refresh
  1199.   #--------------------------------------------------------------------------
  1200.   def refresh
  1201.     # Set item window to visible
  1202.     @item_window1.visible = (@right_window.index == 0)
  1203.     @item_window2.visible = (@right_window.index == 1)
  1204.     @item_window3.visible = (@right_window.index == 2)
  1205.     @item_window4.visible = (@right_window.index == 3)
  1206.     @item_window5.visible = (@right_window.index == 4)
  1207.     # Get currently equipped item
  1208.     item1 = @right_window.item
  1209.     # Set current item window to @item_window
  1210.     case @right_window.index
  1211.     when 0
  1212.       @item_window = @item_window1
  1213.     when 1
  1214.       @item_window = @item_window2
  1215.     when 2
  1216.       @item_window = @item_window3
  1217.     when 3
  1218.       @item_window = @item_window4
  1219.     when 4
  1220.       @item_window = @item_window5
  1221.     end
  1222.     # If right window is active
  1223.     if @right_window.active
  1224.       # Erase parameters for after equipment change
  1225.       TOGGLE_EXTRA_EQUIP ?
  1226.         @left_window.set_new_parameters(nil, nil, nil, nil, nil, nil, nil, nil) :
  1227.         @left_window.set_new_parameters(nil, nil, nil)
  1228.     end
  1229.     # If item window is active
  1230.     if @item_window.active
  1231.       # Get currently selected item
  1232.       item2 = @item_window.item
  1233.       # Change equipment
  1234.       last_hp = @actor.hp
  1235.       last_sp = @actor.sp
  1236.       @actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
  1237.       # Get parameters for after equipment change
  1238.       new_atk = @actor.atk
  1239.       new_pdef = @actor.pdef
  1240.       new_mdef = @actor.mdef
  1241.       if TOGGLE_EXTRA_EQUIP
  1242.         new_str = @actor.str
  1243.         new_dex = @actor.dex
  1244.         new_agi = @actor.agi
  1245.         new_int = @actor.int
  1246.         new_eva = @actor.eva
  1247.       end
  1248.       # Return equipment
  1249.       @actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
  1250.       @actor.hp = last_hp
  1251.       @actor.sp = last_sp
  1252.       # Draw in left window
  1253.       TOGGLE_EXTRA_EQUIP ?
  1254.         @left_window.set_new_parameters(new_atk, new_pdef, new_mdef, new_str, new_dex, new_agi, new_int, new_eva) :
  1255.         @left_window.set_new_parameters(new_atk, new_pdef, new_mdef)
  1256.     end
  1257.   end
  1258. end
  1259.  
  1260. #==============================================================================
  1261. # ** Window_EquipLeft
  1262. #==============================================================================
  1263. class Window_EquipLeft < Window_Base
  1264.   include TWAXP_SETTINGS
  1265.   #--------------------------------------------------------------------------
  1266.   # * Object Initialization
  1267.   #     actor : actor
  1268.   #--------------------------------------------------------------------------
  1269.   def initialize(actor)
  1270.     if TOGGLE_EXTRA_EQUIP; h = 419 else h = 192; end
  1271.     super(0, 64, 272, h)
  1272.     self.contents = Bitmap.new(width - 32, height - 32)
  1273.     @actor = actor
  1274.     refresh
  1275.   end
  1276.   #--------------------------------------------------------------------------
  1277.   # * Refresh
  1278.   #--------------------------------------------------------------------------
  1279.   def refresh
  1280.     self.contents.clear
  1281.     draw_actor_name(@actor, 4, 0)
  1282.     draw_actor_parameter(@actor, 4,  32, 0) #ATK
  1283.     draw_actor_parameter(@actor, 4,  64, 1) #PDEF
  1284.     draw_actor_parameter(@actor, 4,  96, 2) #MDEF
  1285.     if TOGGLE_EXTRA_EQUIP
  1286.       draw_actor_parameter(@actor, 4, 128, 3) #STR
  1287.       draw_actor_parameter(@actor, 4, 160, 4) #DEX
  1288.       draw_actor_parameter(@actor, 4, 192, 5) #AGI
  1289.       draw_actor_parameter(@actor, 4, 224, 6) #INT
  1290.       draw_actor_parameter(@actor, 4, 256, 7) #EVA
  1291.     end
  1292.     if @new_atk != nil
  1293.       self.contents.font.color = system_color
  1294.       self.contents.draw_text(160, 32, 40, 32, "->", 1)
  1295.       self.contents.font.color = normal_color
  1296.       self.contents.font.color = param_color(@actor.atk, @new_atk)
  1297.       self.contents.draw_text(200, 32, 36, 32, @new_atk.to_s, 2)
  1298.     end
  1299.     if @new_pdef != nil
  1300.       self.contents.font.color = system_color
  1301.       self.contents.draw_text(160, 64, 40, 32, "->", 1)
  1302.       self.contents.font.color = normal_color
  1303.       self.contents.font.color = param_color(@actor.pdef, @new_pdef)
  1304.       self.contents.draw_text(200, 64, 36, 32, @new_pdef.to_s, 2)
  1305.     end
  1306.     if @new_mdef != nil
  1307.       self.contents.font.color = system_color
  1308.       self.contents.draw_text(160, 96, 40, 32, "->", 1)
  1309.       self.contents.font.color = normal_color
  1310.       self.contents.font.color = param_color(@actor.mdef, @new_mdef)
  1311.       self.contents.draw_text(200, 96, 36, 32, @new_mdef.to_s, 2)
  1312.     end
  1313.     if TOGGLE_EXTRA_EQUIP
  1314.       if @new_str != nil
  1315.         self.contents.font.color = system_color
  1316.         self.contents.draw_text(160, 128, 40, 32, "->", 1)
  1317.         self.contents.font.color = normal_color
  1318.         self.contents.font.color = param_color(@actor.str, @new_str)
  1319.         self.contents.draw_text(200, 128, 36, 32, @new_str.to_s, 2)
  1320.       end
  1321.       if @new_dex != nil
  1322.         self.contents.font.color = system_color
  1323.         self.contents.draw_text(160, 160, 40, 32, "->", 1)
  1324.         self.contents.font.color = normal_color
  1325.         self.contents.font.color = param_color(@actor.dex, @new_dex)
  1326.         self.contents.draw_text(200, 160, 36, 32, @new_dex.to_s, 2)
  1327.       end
  1328.       if @new_agi != nil
  1329.         self.contents.font.color = system_color
  1330.         self.contents.draw_text(160, 192, 40, 32, "->", 1)
  1331.         self.contents.font.color = normal_color
  1332.         self.contents.font.color = param_color(@actor.agi, @new_agi)
  1333.         self.contents.draw_text(200, 192, 36, 32, @new_agi.to_s, 2)
  1334.       end
  1335.       if @new_int != nil
  1336.         self.contents.font.color = system_color
  1337.         self.contents.draw_text(160, 224, 40, 32, "->", 1)
  1338.         self.contents.font.color = normal_color
  1339.         self.contents.font.color = param_color(@actor.int, @new_int)
  1340.         self.contents.draw_text(200, 224, 36, 32, @new_int.to_s, 2)
  1341.       end
  1342.       if @new_eva != nil
  1343.         self.contents.font.color = system_color
  1344.         self.contents.draw_text(160, 256, 40, 32, "->", 1)
  1345.         self.contents.font.color = normal_color
  1346.         self.contents.font.color = param_color(@actor.eva, @new_eva)
  1347.         self.contents.draw_text(200, 256, 36, 32, @new_eva.to_s, 2)
  1348.       end
  1349.     end
  1350.   end
  1351.   #--------------------------------------------------------------------------
  1352.   # * Set parameters after changing equipment
  1353.   #     new_atk  : attack power after changing equipment
  1354.   #     new_pdef : physical defense after changing equipment
  1355.   #     new_mdef : magic defense after changing equipment
  1356.   #     new_etc  : I think you get the picture
  1357.   #--------------------------------------------------------------------------
  1358.   if TOGGLE_EXTRA_EQUIP
  1359.     def set_new_parameters(new_atk, new_pdef, new_mdef, new_str, new_dex, \
  1360.       new_agi, new_int, new_eva)
  1361.       if @new_atk != new_atk or @new_pdef != new_pdef or @new_mdef != new_mdef or
  1362.         @new_str != new_str or @new_dex != new_dex or @new_agi != new_agi or
  1363.         @new_int != new_int or @new_eva != new_eva
  1364.         @new_atk = new_atk
  1365.         @new_pdef = new_pdef
  1366.         @new_mdef = new_mdef
  1367.         @new_str = new_str
  1368.         @new_dex = new_dex
  1369.         @new_agi = new_agi
  1370.         @new_int = new_int
  1371.         @new_eva = new_eva
  1372.         refresh
  1373.       end
  1374.     end
  1375.   end
  1376. #------------------------------------------------------------------------------
  1377. # * Parameter Colour
  1378. #     Choose text colour based on parameter increase/decrease
  1379. #------------------------------------------------------------------------------
  1380.   def param_color(old_param, new_param)
  1381.     compare = (old_param <=> new_param)
  1382.     case compare
  1383.     when -1 # New eq >
  1384.       return GREEN
  1385.     when 0 # Old = New
  1386.       normal_color
  1387.     when 1 # Old eq >
  1388.       return RED
  1389.     end
  1390.   end
  1391. end
  1392.  
  1393. class Window_EquipItem < Window_Selectable
  1394.   #--------------------------------------------------------------------------
  1395.   # * Object Initialization
  1396.   #     actor      : actor
  1397.   #     equip_type : equip region (0-3)
  1398.   #--------------------------------------------------------------------------
  1399.   def initialize(actor, equip_type)
  1400.     super(272, 256, 368, 224)
  1401.     @actor = actor
  1402.     @equip_type = equip_type
  1403.     @column_max = 1
  1404.     refresh
  1405.     self.active = false
  1406.     self.index = -1
  1407.   end
  1408. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement