Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # Compatibility Patch : v1.0 (1/31/12)
- # YEA System Options + KMS Generic Gauge
- #==============================================================================
- # Script by:
- # Mr. Bubble
- #--------------------------------------------------------------------------
- # Place this script below both YEA System Options and KMS Generic Gauge
- # in your script edtior.
- #
- # Due to the nature of both scripts, several methods in YEA System Options
- # were overwritten.
- #==============================================================================
- module Bubs
- module GGPatch
- #--------------------------------------------------------------------------
- # All Generic Gauge images must be placed in the "Graphics/System"
- # folder of your project.
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- # Window Tone Gauge Settings
- #--------------------------------------------------------------------------
- WINDOW_TONE_GAUGE_SETTINGS = {
- :window_red => "GaugeRed", # Red Tone Gauge
- :window_grn => "GaugeGreen", # Green Tone Gauge
- :window_blu => "GaugeBlue", # Blue Tone Gauge
- #------------------------------------------------------------------------
- # The following settings affect all Window Tone generic gauges
- #------------------------------------------------------------------------
- :offset => [-23, -2], # Gauge Position Offset [x, y]
- :length => -4, # Gauge Length Adjustment
- :slope => 30, # Gauge Slope; Must be between -89 ~ 89 degrees
- } # <-- Do not delete
- #--------------------------------------------------------------------------
- # Volume Gauge Settings
- #--------------------------------------------------------------------------
- VOLUME_GAUGE_SETTINGS = {
- :volume_bgm => "GaugeBGM", # BGM Gauge
- :volume_bgs => "GaugeBGS", # BGS Gauge
- :volume_sfx => "GaugeSFX", # SFX Gauge
- #------------------------------------------------------------------------
- # The following settings affect all Volume generic gauges
- #------------------------------------------------------------------------
- :offset => [-23, -2], # Gauge Position Offset [x, y]
- :length => -4, # Gauge Length Adjustment
- :slope => 30, # Gauge Slope; Must be between -89 ~ 89 degrees
- } # <-- Do not delete
- #--------------------------------------------------------------------------
- # Custom Variable Gauge Settings
- #--------------------------------------------------------------------------
- CUSTOM_VARIABLE_GAUGE_SETTINGS = {
- #------------------------------------------------------------------------
- # Default gauge used if custom variable gauge is not defined
- #------------------------------------------------------------------------
- :default_gauge => "GaugeHP",
- #------------------------------------------------------------------------
- # Variable index must match the same index that you defined in
- # CUSTOM_VARIABLES in YEA System Options. Otherwise, :default_gauge
- # will be used.
- #------------------------------------------------------------------------
- 1 => "GaugeMP", # Variable 1 Gauge
- 2 => "GaugeTP", # Variable 2 Gauge
- #------------------------------------------------------------------------
- # The following settings affect all Custom Variable generic gauges
- #------------------------------------------------------------------------
- :offset => [-23, -2], # Gauge Position Offset [x, y]
- :length => -4, # Gauge Length Adjustment
- :slope => 30, # Gauge Slope; Must be between -89 ~ 89 degrees
- } # <-- Do not delete
- end
- end
- $imported = {} if $imported.nil?
- $kms_imported = {} if $kms_imported.nil?
- #==============================================================================
- # ■ Window_SystemOptions
- #==============================================================================
- class Window_SystemOptions < Window_Command
- if $imported["YEA-SystemOptions"] && $kms_imported["GenericGauge"]
- #--------------------------------------------------------------------------
- # overwrite : draw_window_tone
- #--------------------------------------------------------------------------
- def draw_window_tone(rect, index, symbol)
- name = @list[index][:name]
- draw_text(0, rect.y, contents.width/2, line_height, name, 1)
- #---
- dx = contents.width / 2
- tone = $game_system.window_tone
- case symbol
- when :window_red
- rate = (tone.red + 255.0) / 510.0
- colour1 = Color.new(128, 0, 0)
- colour2 = Color.new(255, 0, 0)
- value = tone.red.to_i
- when :window_grn
- rate = (tone.green + 255.0) / 510.0
- colour1 = Color.new(0, 128, 0)
- colour2 = Color.new(0, 255, 0)
- value = tone.green.to_i
- when :window_blu
- rate = (tone.blue + 255.0) / 510.0
- colour1 = Color.new(0, 0, 128)
- colour2 = Color.new(0, 0, 255)
- value = tone.blue.to_i
- end
- #---
- draw_gauge(Bubs::GGPatch::WINDOW_TONE_GAUGE_SETTINGS[symbol],
- dx, rect.y, contents.width - dx - 48, rate,
- Bubs::GGPatch::WINDOW_TONE_GAUGE_SETTINGS[:offset],
- Bubs::GGPatch::WINDOW_TONE_GAUGE_SETTINGS[:length],
- Bubs::GGPatch::WINDOW_TONE_GAUGE_SETTINGS[:slope])
- #---
- draw_text(dx, rect.y, contents.width - dx - 48, line_height, value, 2)
- end
- #--------------------------------------------------------------------------
- # overwrite : draw_volume
- #--------------------------------------------------------------------------
- def draw_volume(rect, index, symbol)
- name = @list[index][:name]
- draw_text(0, rect.y, contents.width/2, line_height, name, 1)
- #---
- dx = contents.width / 2
- case symbol
- when :volume_bgm
- rate = $game_system.volume(:bgm)
- when :volume_bgs
- rate = $game_system.volume(:bgs)
- when :volume_sfx
- rate = $game_system.volume(:sfx)
- end
- colour1 = text_color(YEA::SYSTEM::COMMAND_VOCAB[symbol][1])
- colour2 = text_color(YEA::SYSTEM::COMMAND_VOCAB[symbol][2])
- value = sprintf("%d%%", rate)
- rate *= 0.01
- #---
- draw_gauge(Bubs::GGPatch::VOLUME_GAUGE_SETTINGS[symbol],
- dx, rect.y, contents.width - dx - 48, rate,
- Bubs::GGPatch::VOLUME_GAUGE_SETTINGS[:offset],
- Bubs::GGPatch::VOLUME_GAUGE_SETTINGS[:length],
- Bubs::GGPatch::VOLUME_GAUGE_SETTINGS[:slope])
- #---
- draw_text(dx, rect.y, contents.width - dx - 48, line_height, value, 2)
- end
- #--------------------------------------------------------------------------
- # overwrite : draw_custom_variable
- #--------------------------------------------------------------------------
- def draw_custom_variable(rect, index, ext)
- name = @list[index][:name]
- draw_text(0, rect.y, contents.width/2, line_height, name, 1)
- #---
- dx = contents.width / 2
- value = $game_variables[YEA::SYSTEM::CUSTOM_VARIABLES[ext][0]]
- colour1 = text_color(YEA::SYSTEM::CUSTOM_VARIABLES[ext][2])
- colour2 = text_color(YEA::SYSTEM::CUSTOM_VARIABLES[ext][3])
- minimum = YEA::SYSTEM::CUSTOM_VARIABLES[ext][4]
- maximum = YEA::SYSTEM::CUSTOM_VARIABLES[ext][5]
- rate = (value - minimum).to_f / [(maximum - minimum).to_f, 0.01].max
- dx = contents.width/2
- #---
- var_index = YEA::SYSTEM::CUSTOM_VARIABLES[ext][0]
- if Bubs::GGPatch::CUSTOM_VARIABLE_GAUGE_SETTINGS.include?(var_index)
- image = Bubs::GGPatch::CUSTOM_VARIABLE_GAUGE_SETTINGS[var_index]
- else
- image = Bubs::GGPatch::CUSTOM_VARIABLE_GAUGE_SETTINGS[:default_gauge]
- end
- draw_gauge(image, dx, rect.y, contents.width - dx - 48, rate,
- Bubs::GGPatch::CUSTOM_VARIABLE_GAUGE_SETTINGS[:offset],
- Bubs::GGPatch::CUSTOM_VARIABLE_GAUGE_SETTINGS[:length],
- Bubs::GGPatch::CUSTOM_VARIABLE_GAUGE_SETTINGS[:slope])
- #---
- draw_text(dx, rect.y, contents.width - dx - 48, line_height, value, 2)
- end
- end # $imported
- end
Advertisement
Add Comment
Please, Sign In to add comment