Jump to content
Rpg²S Forum

Jack

Utenti
  • Posts

    219
  • Joined

  • Last visited

Posts posted by Jack

  1. Sono arrivato ad una conclusione su questo "hack" in verità non è un programma sono solo delle modifiche al file quindi penso che non ci sia un modo per fermarlo ammeno che qualcuno non inventi un protezione piu potente per gli archivi.

     

    PS: l'ho scoperto poco fa!

  2. Beh con l'AMS e con gli eventi non è tanto difficile se vuoi ti posto la demo così capisci meglio

    Davvero ??? non so come ringraziarti !!!!!!!!!!!!! sei il mio idolo :tongue: :sisi: :sisi: :biggrin: :biggrin:

  3. Ok, ma mi è stato consigliato dallo staff di pubblicarlo lì perchè forse avrei avuto qualche informazione in piu!

    Però come ho detto non so perchè non lo ha messo negli sportelli aiuti veloci!!

  4. Salve a tutti mi dispiace se in tutto questo tempo non sono stato presente nel forum!!

    Ma per recuperare o trovato qualche buona risorsa per Naruto!!! :sisi:

    Petryx contattami in pvt!! :tongue:

  5. Ecco qui un piccolo script HUD kingdom hearts Davvero Bello!!!Spero di esservi stato utile e adesso lascio a voi i commenti!!!

    Autore: SephirothSpawn
    Versione: 1.0

    image gioco:
    http://www.owainc.net/images/kingdom_hearts_2_hud/target.PNG

    image RMXP:
    http://www.owainc.net/images/kingdom_heart...ud/screen_1.PNG

    SCRIPT:

     

    #==============================================================================
    # ** Kingdom Hearts II HUD
    #------------------------------------------------------------------------------
    # SephirothSpawn
    # Version 1.0
    # 2008-09-17
    #------------------------------------------------------------------------------
    # * Description:
    #
    # This script was designed to remake the arc gradient bar HUD from Kingdom
    # Hearts 2. It shows the HP and SP values, with a custom feature that
    # will make the face change when hp drops, hp rises, your actor
    # dies, or life falls below 25% health.
    #
    # All HUD dimensions are customizable, although I did make a basic setup
    # nearly perfectly matching the Kingdom Hearts 2 HUD. You may also toggle
    # the visibility when a switch is on or off.
    #------------------------------------------------------------------------------
    # * Instructions:
    #
    # Place the script below the SDK (if included) and above main.
    #
    # Change the constant in Kingdom_Hearts_2_HUD module.
    #------------------------------------------------------------------------------
    # * Requirements:
    #
    # Method and Class Library 2.3+
    #------------------------------------------------------------------------------
    # * Terms & Conditions:
    #
    # Copyright © 2007 SephirothSpawn (Timothy Hoffman)
    # Free for non-commercial use.
    # 40 USD commercial license. Contact via. SephirothSpawn@hotmail.com
    #
    # Any modifications to the system are not to be re-distributed without my
    # consent.
    #==============================================================================
    
    #==============================================================================
    # ** SDK Log
    #==============================================================================
    
    if Object.const_defined?(:SDK)
    	SDK.log('Kingdom Hearts II HUD', 'SephirothSpawn', 1.0, '2008-09-17')
    end
    
    #------------------------------------------------------------------------------
    # * Begin SDK Enable Test
    #------------------------------------------------------------------------------
    if Object.const_defined?(:SDK) == false || SDK.enabled?('Kingdom Hearts II HUD')
    	
    	#==============================================================================
    	# ** Kingdom_Hearts_2_HUD
    	#==============================================================================
    	
    	module Kingdom_Hearts_2_HUD
    		#--------------------------------------------------------------------------
    		# * Faces Directory
    		#--------------------------------------------------------------------------
    		Face_Folder = 'Graphics/HUD Faces/'
    		#--------------------------------------------------------------------------
    		# * Background & Cover Images
    		#
    		# The background image will be displayed below everything
    		# The cover image will be drawn over everything
    		# Draw Background will draw pixel borders are gradient bars
    		# Draw SP Background will draw pixel borders are sp bar
    		#--------------------------------------------------------------------------
    		Background_Image = nil
    		Cover_Image = nil
    		Draw_Background = true
    		Draw_SP_Background = true
    		#--------------------------------------------------------------------------
    		# * Faces Size: Rect.new(0, 0, width, height)
    		#--------------------------------------------------------------------------
    		Main_Face_Rect = Rect.new(525, 369, 86, 86)
    		Sub_Face_Rect = Rect.new(573, 307, 46, 46)
    		#--------------------------------------------------------------------------
    		# * Main HUD Preferences
    		#--------------------------------------------------------------------------
    		Main_Center_X = 568
    		Main_Center_Y = 412
    		Main_HP_Min_Radius = 36
    		Main_HP_Max_Radius = 50
    		Main_HP_Border_Width = 2
    		Main_HP_Tail_Length = 172
    		Main_HP_Color = Color.new(188, 243, 62)
    		Main_HP_Color2 = Color.new(53, 215, 18)
    		Main_SP_Length = 150
    		Main_SP_Height = Draw_Background ? 8 : Draw_SP_Background ? 12 : 8
    		Main_SP_Border_Width = 2
    		Main_SP_Overlap = 6
    		Main_SP_Color = Color.new(9, 141, 255)
    		Main_SP_Color2 = Color.new(8, 101, 222)
    		Main_HP_Background = Color.new(50, 50, 50)
    		Main_SP_Backgorund = Color.new(25, 25, 25)
    		#--------------------------------------------------------------------------
    		# * Sub HUD Dimensions
    		#--------------------------------------------------------------------------
    		Sub_Center_X = 596
    		Sub_Center_Y = 332
    		Sub_Center_Diff = 56
    		Sub_Min_Radius = 20
    		Sub_Max_Radius = 26
    		Sub_Border_Width = 2
    		Sub_HP_Color = Main_HP_Color
    		Sub_HP_Color2 = Main_HP_Color2
    		Sub_SP_Color = Main_SP_Color
    		Sub_SP_Color2 = Main_SP_Color2
    		Sub_Background_Color = Color.new(50, 50, 50)
    		#--------------------------------------------------------------------------
    		# * Visibility Switch
    		#--------------------------------------------------------------------------
    		Switch_ID = 1
    		#--------------------------------------------------------------------------
    		# * Faces
    		#--------------------------------------------------------------------------
    		Enable_Complex_Faces = true
    		Complex_Face_Change = 20
    		Complex_Faces = {
    		'hp_down' => '_hp_down',
    		'hp_up' => '_hp_up',
    		'crisis' => '_crisis',
    		'dead' => '_dead',
    		}
    		#--------------------------------------------------------------------------
    		# * Load Face
    		#--------------------------------------------------------------------------
    		def self.face(actor)
    			begin
    				return RPG::Cache.load_bitmap(Face_Folder,
    				actor.kh_face, actor.character_hue)
    				rescue
    				return RPG::Cache.load_bitmap(Face_Folder,
    				actor.kh_face_base, actor.character_hue)
    			end
    		end
    		#--------------------------------------------------------------------------
    		# * Background
    		#--------------------------------------------------------------------------
    		def self.background
    			return RPG::Cache.load_bitmap(Face_Folder, Background_Image)
    		end
    		#--------------------------------------------------------------------------
    		# * Cover
    		#--------------------------------------------------------------------------
    		def self.cover
    			return RPG::Cache.load_bitmap(Face_Folder, Cover_Image)
    		end
    	end
    	
    	#==============================================================================
    	# ** Game_Actor
    	#==============================================================================
    	
    	class Game_Actor
    		#--------------------------------------------------------------------------
    		# * Public Instance Variables
    		#--------------------------------------------------------------------------
    		attr_accessor :kh_face_suffix
    		#--------------------------------------------------------------------------
    		# * Kingdom Hearts Face Base
    		#--------------------------------------------------------------------------
    		def kh_face_base
    			return character_name
    		end
    		#--------------------------------------------------------------------------
    		# * Kingdom Hearts Face
    		#--------------------------------------------------------------------------
    		def kh_face
    			begin
    				return "#{kh_face_base}#{kh_face_suffix.nil? ? '' : kh_face_suffix}"
    				rescue
    				return kh_face_base
    			end
    		end
    	end
    	
    	#==============================================================================
    	# ** Kingdom_Hearts_2_HUD::Window_HUD
    	#==============================================================================
    	
    	class Kingdom_Hearts_2_HUD::Window_HUD < Window_Base
    		#--------------------------------------------------------------------------
    		# * Include Constants
    		#--------------------------------------------------------------------------
    		include Kingdom_Hearts_2_HUD
    		#--------------------------------------------------------------------------
    		# * Math Calculations
    		#--------------------------------------------------------------------------
    		c = Main_HP_Min_Radius + (Main_HP_Max_Radius - Main_HP_Min_Radius) / 2
    		c *= 2 * Math::PI * 4 / 3
    		HP_Arc_Percent = c / (c + Main_HP_Tail_Length)
    		HP_Arc_Color = Color.color_between(Main_HP_Color, Main_HP_Color2,
    		HP_Arc_Percent)
    		#--------------------------------------------------------------------------
    		# * Object Initialization
    		#--------------------------------------------------------------------------
    		def initialize
    			super(-16, -16, 672, 512)
    			self.contents = Bitmap.new(width - 32, height - 32)
    			self.opacity = 0
    			# If background exist
    			if Background_Image != nil
    				# Draw background
    				b = Kingdom_Hearts_2_HUD.background
    				self.contents.blt(0, 0, b, b.rect)
    			end
    			# Set empty actors
    			@actors = []
    			# Save face changes
    			@face_suffix, @face_time = [], []
    			# Update
    			update
    			# If cover exist
    			if Cover_Image != nil
    				# Draw Cover
    				b = Kingdom_Hearts_2_HUD.cover
    				self.contents.blt(0, 0, b, b.rect)
    			end
    		end
    		#--------------------------------------------------------------------------
    		# * Frame Update
    		#--------------------------------------------------------------------------
    		def update
    			super
    			# Update visibility
    			self.visible = $game_switches[switch_ID]
    			# Stop if not visible
    			return unless self.visible
    			# If no actors
    			if $game_party.actors.size == 0
    				# Clear window and return
    				self.contents.clear
    				return
    			end
    			# Update face suffix
    			for i in 0...[@actors.size, $game_party.actors.size].max
    				update_face_suffix(i)
    			end
    			
    			
    			
    			# If main actor has changed
    			if actor_changed?($game_party.actors[0], @actors[0])
    				# Save actor
    				@actors[0] = $game_party.actors[0].dup
    				# Clear main
    				clear_main
    				# Draw main HP Background
    				draw_main_background if Draw_Background
    				# Draw main HP Bar
    				draw_main_hp_bar
    				# Draw main face
    				draw_main_face
    				# Draw main SP bar
    				draw_main_sp_bar
    			end
    			# Pass through sub actors
    			for i in 1...[@actors.size, $game_party.actors.size].max
    				# If nil actor
    				if $game_party.actors[i] == nil
    					# Set nil actor
    					@actors[i] = nil
    					# Clear area and skip to next
    					clear_sub(i)
    					next
    				end
    				# If sub actor has changed
    				if actor_changed?($game_party.actors[i], @actors[i])
    					# Save actor
    					@actors[i] = $game_party.actors[i].dup
    					# Clear sub area
    					clear_sub(i)
    					# Draw sub background
    					draw_sub_background(i) if Draw_Background
    					# Draw sub HP bar
    					draw_sub_hp_bar(i)
    					# Draw sub SP bar
    					draw_sub_sp_bar(i)
    					# Draw sub face
    					draw_sub_face(i)
    				end
    			end
    		end
    		#--------------------------------------------------------------------------
    		# * Update Face Suffix
    		#--------------------------------------------------------------------------
    		def update_face_suffix(i)
    			# Return if not complex faces
    			return unless Enable_Complex_Faces
    			# Get new and old actor
    			new_actor, old_actor = $game_party.actors[i], @actors[i]
    			# If id is different
    			if new_actor.id != old_actor.id
    				# Clear both suffixes
    				new_actor.kh_face_suffix = '' unless new_actor == nil
    				old_actor.kh_face_suffix = '' unless old_actor == nil
    				# Clear time and suffix
    				@face_suffix[i] = nil
    				@face_time[i] = nil
    				return
    			end
    			# If dead
    			if new_actor.dead?
    				suffix = Complex_Faces['dead']
    				# If less life
    			elsif new_actor.hp < old_actor.hp
    				suffix = Complex_Faces['hp_down']
    				# If more life
    			elsif new_actor.hp > old_actor.hp
    				suffix = Complex_Faces['hp_up']
    				# If crisis
    			elsif new_actor.hp <= new_actor.maxhp / 4 && new_actor.kh_face_suffix == ''
    				suffix = Complex_Faces['crisis']
    			else
    				suffix = ''
    			end
    			# If suffix exist
    			if suffix != ''
    				# Change suffix
    				new_actor.kh_face_suffix = suffix
    				@face_suffix[i] = suffix
    				@face_time[i] = Complex_Face_Change
    				return
    			end
    			# Return if no face suffix
    			if @face_time[i] == nil
    				@face_suffix[i] = nil
    				return
    			end
    			# If time is greater than 0
    			if @face_time[i] > 0
    				# Subtract time
    				@face_time[i] -= 1
    				return
    			end
    			# Return if suffix is dead or crisis
    			return if [Complex_Faces['crisis'],
    			Complex_Faces['dead']].include?(new_actor.kh_face_suffix)
    			# Clear suffix
    			new_actor.kh_face_suffix = ''
    			@face_suffix[i] = nil
    			@face_time[i] = nil
    		end
    		#--------------------------------------------------------------------------
    		# * Clear Main
    		#--------------------------------------------------------------------------
    		def clear_main
    			# Get rect
    			rx = Main_Center_X - Main_HP_Tail_Length - Main_HP_Border_Width
    			ry = Main_Center_Y - Main_HP_Max_Radius - Main_HP_Border_Width
    			rw = Main_Center_X + Main_HP_Max_Radius + Main_HP_Border_Width - rx
    			rh = Main_HP_Max_Radius * 2 + Main_HP_Border_Width * 2
    			rect = Rect.new(rx, ry, rw, rh)
    			# Clear area
    			self.contents.fill_rect(rect, Color.clear)
    			# Draw background
    			if Background_Image != nil
    				# Draw background
    				b = Kingdom_Hearts_2_HUD.background
    				self.contents.blt(rx, ry, b, rect)
    			end
    		end
    		#--------------------------------------------------------------------------
    		# * Draw Background
    		#--------------------------------------------------------------------------
    		def draw_main_background
    			# Draw arc region
    			self.contents.draw_cw_arc_region(Main_Center_X, Main_Center_Y,
    			Main_HP_Min_Radius - Main_HP_Border_Width, Main_HP_Max_Radius +
    			Main_HP_Border_Width, 180, 270, 1, 1, Main_HP_Background)
    			# Draws corner border
    			ox = Main_Center_X - Main_HP_Max_Radius - Main_HP_Border_Width
    			oy = Main_Center_Y
    			ow = (Main_HP_Max_Radius - Main_HP_Min_Radius) + Main_HP_Border_Width * 2
    			oh = Main_HP_Border_Width
    			self.contents.fill_rect(ox, oy, ow, oh, Main_HP_Background)
    			# Get HP tail dimensions
    			ox = Main_Center_X - Main_HP_Tail_Length - Main_HP_Border_Width
    			oy = Main_Center_Y + Main_HP_Min_Radius - Main_HP_Border_Width
    			ow = Main_HP_Tail_Length + Main_HP_Border_Width
    			oh = Main_HP_Max_Radius - Main_HP_Min_Radius + Main_HP_Border_Width * 2
    			# Draw bar
    			self.contents.fill_rect(ox, oy, ow, oh, Main_HP_Background)
    		end
    		#--------------------------------------------------------------------------
    		# * Draw Main HP
    		#--------------------------------------------------------------------------
    		def draw_main_hp_bar
    			# Get current and max values
    			cur, max = @actors[0].hp, @actors[0].maxhp
    			# Adjust for arc region
    			max = Integer(max * HP_Arc_Percent)
    			cur = [max, cur].min
    			# Gets center and radi
    			cx, cy = Main_Center_X, Main_Center_Y
    			mnr, mxr = Main_HP_Min_Radius, Main_HP_Max_Radius
    			# Draw Arc Region
    			if Main_HP_Color2 == nil
    				self.contents.draw_cw_arc_region(cx, cy, mnr, mxr, 180, 270, cur, max,
    				Main_HP_Color)
    			else
    				self.contents.draw_cw_grad_arc_region(cx, cy, mnr, mxr, 180, 270, cur,
    				max, Main_HP_Color, HP_Arc_Color)
    			end
    			# Gets max subtraction
    			max_sub = Integer(@actors[0].maxhp * HP_Arc_Percent)
    			# Get new cur & max
    			cur, max = @actors[0].hp, @actors[0].maxhp
    			cur -= max_sub ; max -= max_sub
    			# Return if cur < 0
    			return unless cur > 0
    			# Get HP tail dimensions
    			ox = Main_Center_X - Main_HP_Tail_Length
    			oy = Main_Center_Y + Main_HP_Min_Radius
    			ow = Main_HP_Tail_Length
    			oh = Main_HP_Max_Radius - Main_HP_Min_Radius
    			# Draw reverse bar
    			if Main_HP_Color2 == nil
    				self.contents.draw_rev_bar(ox, oy, ow, oh, cur, max, Main_HP_Color)
    			else
    				self.contents.draw_rev_grad_bar(ox, oy - 1, ow, oh + 2, cur, max,
    				HP_Arc_Color, Main_HP_Color2)
    			end
    		end
    		#--------------------------------------------------------------------------
    		# * Draw Main SP
    		#--------------------------------------------------------------------------
    		def draw_main_sp_bar
    			# If draw background
    			if Draw_Background
    				# Get SP tail dimensions
    				ox = Main_Center_X - Main_HP_Tail_Length - Main_HP_Border_Width
    				oy = Main_Center_Y + Main_HP_Min_Radius - Main_HP_Border_Width
    				oy -= Main_SP_Height - Main_SP_Overlap
    				ow = Main_SP_Length + Main_SP_Border_Width * 2
    				oh = Main_SP_Height + Main_SP_Border_Width * 2
    				# Draw border
    				self.contents.fill_rect(ox, oy, ow, oh, Main_SP_Backgorund)
    				# Get gradient dimensions
    				ox += Main_SP_Border_Width
    				oy += Main_SP_Border_Width
    				# Draw reverse bar
    				if Main_SP_Color2 == nil
    					self.contents.draw_rev_bar(ox, oy, Main_SP_Length, Main_SP_Height,
    					@actors[0].sp, @actors[0].maxsp, Main_SP_Color)
    				else
    					self.contents.draw_rev_grad_bar(ox, oy, Main_SP_Length, Main_SP_Height,
    					@actors[0].sp, @actors[0].maxsp, Main_SP_Color, Main_SP_Color2)
    				end
    				# If draw sp background
    			elsif Draw_SP_Background
    				# Get SP tail dimensions
    				ox = Main_Center_X - Main_HP_Tail_Length
    				oy = Main_Center_Y + Main_HP_Min_Radius - Main_SP_Height + Main_SP_Overlap
    				ow = Main_SP_Length
    				oh = Main_SP_Height
    				# Draw border
    				self.contents.fill_rect(ox, oy, ow, oh, Main_SP_Backgorund)
    				# Offset border
    				ox += Main_SP_Border_Width ; oy += Main_SP_Border_Width
    				ow -= Main_SP_Border_Width * 2; oh -= Main_SP_Border_Width * 2
    				# Draw reverse bar
    				if Main_SP_Color2 == nil
    					self.contents.draw_rev_bar(ox, oy, ow, oh,
    					@actors[0].sp, @actors[0].maxsp, Main_SP_Color)
    				else
    					self.contents.draw_rev_grad_bar(ox, oy, ow, oh,
    					@actors[0].sp, @actors[0].maxsp, Main_SP_Color, Main_SP_Color2)
    				end
    			else
    				# Get SP tail dimensions
    				ox = Main_Center_X - Main_HP_Tail_Length
    				oy = Main_Center_Y + Main_HP_Min_Radius - Main_SP_Height + Main_SP_Overlap
    				# Draw reverse bar
    				if Main_SP_Color2 == nil
    					self.contents.draw_rev_bar(ox, oy, Main_HP_Tail_Length, Main_SP_Height,
    					@actors[0].sp, @actors[0].maxsp, Main_SP_Color)
    				else
    					self.contents.draw_rev_grad_bar(ox, oy, Main_HP_Tail_Length,
    					Main_SP_Height, @actors[0].sp, @actors[0].maxsp, Main_SP_Color,
    					Main_SP_Color2)
    				end
    			end
    			# Get rect
    			rx = Main_Center_X - Main_HP_Tail_Length - Main_HP_Border_Width
    			ry = Main_Center_Y - Main_HP_Max_Radius - Main_HP_Border_Width
    			rw = Main_Center_X + Main_HP_Max_Radius + Main_HP_Border_Width - rx
    			rh = Main_HP_Max_Radius * 2 + Main_HP_Border_Width * 2
    			rect = Rect.new(rx, ry, rw, rh)
    			# Draw Cover
    			if Cover_Image != nil
    				# Draw cover
    				b = Kingdom_Hearts_2_HUD.cover
    				self.contents.blt(rx, ry, b, rect)
    			end
    		end
    		#--------------------------------------------------------------------------
    		# * Draw Main Face
    		#--------------------------------------------------------------------------
    		def draw_main_face
    			# Gets bitmap
    			bitmap = Kingdom_Hearts_2_HUD.face(@actors[0])
    			# Draws face
    			self.contents.stretch_blt(Main_Face_Rect, bitmap, bitmap.rect)
    		end
    		#--------------------------------------------------------------------------
    		# * Sub Center Y
    		#--------------------------------------------------------------------------
    		def sub_center_y(i)
    			y = Sub_Center_Y
    			y -= Sub_Center_Diff * (i - 1)
    		end
    		#--------------------------------------------------------------------------
    		# * Clear Sub
    		#--------------------------------------------------------------------------
    		def clear_sub(i)
    			# Get rect
    			rx = Sub_Center_X - Sub_Max_Radius - Sub_Border_Width
    			ry = sub_center_y(i) - Sub_Max_Radius - Sub_Border_Width
    			rw = rh = Sub_Max_Radius * 2 + Sub_Border_Width + 2
    			rect = Rect.new(rx, ry, rw, rh)
    			# Clear area
    			self.contents.fill_rect(rect, Color.clear)
    			# Draw background
    			if Background_Image != nil
    				# Draw background
    				b = Kingdom_Hearts_2_HUD.background
    				self.contents.blt(rx, ry, b, rect)
    			end
    		end
    		#--------------------------------------------------------------------------
    		# * Draw Sub Background
    		#--------------------------------------------------------------------------
    		def draw_sub_background(i)
    			# Gets center
    			cx, cy = Sub_Center_X, sub_center_y(i)
    			# Draw outer circle
    			self.contents.draw_circle(cx, cy, Sub_Max_Radius + Sub_Border_Width,
    			Sub_Background_Color)
    			# Clear inner circle
    			self.contents.draw_circle(cx, cy, Sub_Min_Radius - Sub_Border_Width,
    			Color.clear)
    		end
    		#--------------------------------------------------------------------------
    		# * Draw Sub HP Bar
    		#--------------------------------------------------------------------------
    		def draw_sub_hp_bar(i)
    			# Get actor
    			a = @actors[i]
    			# Gets center
    			cx, cy = Sub_Center_X, sub_center_y(i)
    			# Draw arc region
    			if Sub_HP_Color2 == nil
    				self.contents.draw_cw_arc_region(cx, cy, Sub_Min_Radius, Sub_Max_Radius,
    				268, 92, a.hp, a.maxhp, Sub_HP_Color)
    			else
    				self.contents.draw_cw_grad_arc_region(cx, cy, Sub_Min_Radius,
    				Sub_Max_Radius, 268, 92, a.hp, a.maxhp, Sub_HP_Color, Sub_HP_Color2)
    			end
    		end
    		#--------------------------------------------------------------------------
    		# * Draw Sub SP Bar
    		#--------------------------------------------------------------------------
    		def draw_sub_sp_bar(i)
    			# Get actor
    			a = @actors[i]
    			# Gets center
    			cx, cy = Sub_Center_X, sub_center_y(i)
    			# Draw arc region
    			if Sub_SP_Color2
    				self.contents.draw_ccw_arc_region(cx, cy, Sub_Min_Radius, Sub_Max_Radius,
    				272, 88, a.sp, a.maxsp, Sub_SP_Color)
    			else
    				self.contents.draw_ccw_grad_arc_region(cx, cy, Sub_Min_Radius,
    				Sub_Max_Radius, 272, 88, a.sp, a.maxsp, Sub_SP_Color, Sub_SP_Color2)
    			end
    		end
    		#--------------------------------------------------------------------------
    		# * Draw Sub Face
    		#--------------------------------------------------------------------------
    		def draw_sub_face(i)
    			# Gets dest rect
    			dx = Sub_Face_Rect.x
    			dy = Sub_Face_Rect.y - Sub_Center_Diff * (i - 1)
    			dest_rect = Rect.new(dx, dy, Sub_Face_Rect.width, Sub_Face_Rect.height)
    			# Gets bitmap
    			bitmap = Kingdom_Hearts_2_HUD.face(@actors[i])
    			# Draws face
    			self.contents.stretch_blt(dest_rect, bitmap, bitmap.rect)
    			# Get rect
    			rx = Sub_Center_X - Sub_Max_Radius - Sub_Border_Width
    			ry = sub_center_y(i) - Sub_Max_Radius - Sub_Border_Width
    			rw = rh = Sub_Max_Radius * 2 + Sub_Border_Width + 2
    			rect = Rect.new(rx, ry, rw, rh)
    			# Draw cover
    			if Cover_Image != nil
    				# Draw cover
    				b = Kingdom_Hearts_2_HUD.cover
    				self.contents.blt(rx, ry, b, rect)
    			end
    		end
    		#--------------------------------------------------------------------------
    		# * Actor Changed?
    		#--------------------------------------------------------------------------
    		def actor_changed?(a1, a2)
    			return true unless a2.is_a?(Game_Actor)
    			return a1.hp != a2.hp || a1.maxhp != a2.maxhp ||
    			a1.sp != a2.sp || a1.maxsp != a2.maxsp ||
    			a1.kh_face != a2.kh_face ||
    			a1.character_hue != a2.character_hue
    		end
    	end
    	
    	#==============================================================================
    	# ** Scene_Map
    	#==============================================================================
    	
    	class Scene_Map
    		#--------------------------------------------------------------------------
    		# * Main Window
    		#--------------------------------------------------------------------------
    		if Object.const_defined?(:SDK)
    			alias_method :seph_kh2hud_mw, :main_window
    			def main_window
    				seph_kh2hud_mw
    				@hud = Kingdom_Hearts_2_HUD::Window_HUD.new
    			end
    		else
    			alias_method :seph_kh2hud_m, :main
    			def main
    				seph_kh2hud_m
    				@hud = Kingdom_Hearts_2_HUD::Window_HUD.new
    			end
    		end
    	end
    	
    	#==============================================================================
    	# ** Bitmap
    	#==============================================================================
    	
    	class Bitmap
    		#--------------------------------------------------------------------------
    		# * Draw Clockwise Circular Arc Region
    		#--------------------------------------------------------------------------
    		def draw_cw_arc_region(x, y, min_rad, max_rad, s_angle, e_angle,
    			cur_v, max_v, color = Color.red)
    			# Calculate Inner Regions
    			inner_region = {}
    			for i in 0..min_rad
    				y_ = Integer((min_rad ** 2 - i ** 2) ** 0.5)
    				inner_region[x + i] = y_
    				inner_region[x - i] = y_
    			end
    			# Make Degrees between 0 - 360
    			s_angle %= 360 ; e_angle %= 360
    			# Make s_angle Greater than e_angle
    			s_angle += 360 if s_angle < e_angle
    			# Calculate Difference
    			diff = s_angle - e_angle
    			# Get Percent Difference
    			p_diff = Integer(diff * cur_v / max_v.to_f)
    			# Modify e_angle with percent Diffence
    			e_angle = s_angle - p_diff
    			# Pass from left to right
    			for i in (x - max_rad)..(x + max_rad)
    				# Get Y max at that pixel
    				y_max = Integer((max_rad ** 2 - (x - i).abs ** 2) ** 0.5)
    				# Pass from top to bottom
    				for j in (y - y_max)..(y + y_max)
    					# If Inner region has key
    					if inner_region.has_key?(i)
    						# Get Inner Value
    						inner = inner_region[i]
    						# Skip if Between inner region limits
    						next if j.between?(y - inner, y + inner)
    					end
    					# Gets Angle of pixel from center
    					a = Math.atan2((j - y).abs, (i - x).abs.to_f) * 180 / Math::PI
    					# Get 360 Degree Angle
    					if (i - x) > 0
    						a = 360 - a if (j - y) > 0
    					else
    						a = 180 + ((j - y) > 0 ? a : -a)
    					end
    					# Set Pixel if Between Angles
    					if Math.cw_between_angles?(a, s_angle, e_angle)
    						set_pixel(i, j, color)
    					end
    				end
    			end
    		end
    		#--------------------------------------------------------------------------
    		# * Draw Counter-Clockwise Circular Arc Region
    		#--------------------------------------------------------------------------
    		def draw_ccw_arc_region(x, y, min_rad, max_rad, s_angle, e_angle,
    			cur_v, max_v, color = Color.red)
    			# Make Degrees between 0 - 360
    			s_angle %= 360 ; e_angle %= 360
    			# Make e_angle Greater than s_angle
    			e_angle += 360 if e_angle < s_angle
    			# Calculate Difference
    			diff = e_angle - s_angle
    			# Get Percent Difference
    			p_diff = Integer(diff * cur_v / max_v.to_f)
    			# Modify e_angle with percent Diffence
    			e_angle = s_angle + p_diff
    			# Draw CW Arc Region
    			draw_cw_arc_region(x, y, min_rad, max_rad, e_angle, s_angle, 1, 1, color)
    		end
    		#--------------------------------------------------------------------------
    		# * Draw Clockwise Gradient Circular Arc Region
    		#--------------------------------------------------------------------------
    		def draw_cw_grad_arc_region(x, y, min_rad, max_rad, s_angle, e_angle,
    			cur_v, max_v, s_color = Color.red,
    			e_color = Color.blue)
    			# Calculate Inner Regions
    			inner_region = {}
    			for i in 0..min_rad
    				y_ = Integer((min_rad ** 2 - i ** 2) ** 0.5)
    				inner_region[x + i] = y_
    				inner_region[x - i] = y_
    			end
    			# Make Degrees between 0 - 360
    			s_angle %= 360 ; e_angle %= 360
    			# Make s_angle Greater than e_angle
    			s_angle += 360 if s_angle < e_angle
    			# Calculate Difference
    			diff = s_angle - e_angle
    			# Get Percent Difference
    			p_diff = Integer(diff * cur_v / max_v.to_f)
    			# Modify e_angle with percent Diffence
    			e_angle = s_angle - p_diff
    			# Pass from left to right
    			for i in (x - max_rad)..(x + max_rad)
    				# Get Y max at that pixel
    				y_max = Integer((max_rad ** 2 - (x - i).abs ** 2) ** 0.5)
    				# Pass from top to bottom
    				for j in (y - y_max)..(y + y_max)
    					# If Inner region has key
    					if inner_region.has_key?(i)
    						# Get Inner Value
    						inner = inner_region[i]
    						# Skip if Between inner region limits
    						next if j.between?(y - inner, y + inner)
    					end
    					# Gets Angle of pixel from center
    					a = Math.atan2((j - y).abs, (i - x).abs.to_f) * 180 / Math::PI
    					# Get 360 Degree Angle
    					if (i - x) > 0
    						a = 360 - a if (j - y) > 0
    					else
    						a = 180 + ((j - y) > 0 ? a : -a)
    					end
    					# If Between Angles
    					if Math.cw_between_angles?(a, s_angle, e_angle)
    						# Get Color Value
    						per = Math.cw_percent_between_angles(a, s_angle, s_angle - diff)
    						color = Color.color_between(e_color, s_color, per)
    						# Set Pixel
    						set_pixel(i, j, color)
    					end
    				end
    			end
    		end
    		#--------------------------------------------------------------------------
    		# * Draw Counter-Clockwise Gradient Circular Arc Region
    		#--------------------------------------------------------------------------
    		def draw_ccw_grad_arc_region(x, y, min_rad, max_rad, s_angle, e_angle,
    			cur_v, max_v, s_color = Color.red,
    			e_color = Color.blue)
    			# Make Degrees between 0 - 360
    			s_angle %= 360 ; e_angle %= 360
    			# Make e_angle Greater than s_angle
    			e_angle += 360 if e_angle < s_angle
    			# Calculate Difference
    			diff = e_angle - s_angle
    			# Get Percent Difference
    			p_diff = Integer(diff * cur_v / max_v.to_f)
    			# Modify e_angle with percent Diffence
    			e_angle2 = s_angle + p_diff
    			# Modify colors
    			per = Math.ccw_percent_between_angles(e_angle2, s_angle, e_angle)
    			sc = Color.color_between(s_color, e_color, per)
    			ec = s_color
    			# Draw CW Grad Arc Region
    			draw_cw_grad_arc_region(x, y, min_rad, max_rad, e_angle2, s_angle, 1, 1,
    			sc, ec)
    		end
    		#--------------------------------------------------------------------------
    		# * Draw Reverse Bar
    		#--------------------------------------------------------------------------
    		def draw_rev_bar(x, y, width, height, cur, max, color = Color.red)
    			bar_width = Integer((cur / max.to_f) * width)
    			self.fill_rect(x + width - bar_width, y, bar_width, height, color)
    		end
    		#--------------------------------------------------------------------------
    		# * Draw Reverse Gradient Bar
    		#--------------------------------------------------------------------------
    		def draw_rev_grad_bar(x, y, width, height, cur, max, s_color = Color.red,
    			e_color = Color.blue)
    			for i in 0...((cur / max.to_f) * width)
    				c = Color.color_between(s_color, e_color, (i / width.to_f))
    				self.fill_rect(x + width - 1 - i, y + 1, 1, height - 2, c)
    			end
    		end
    	end
    	
    	#------------------------------------------------------------------------------
    	# * End SDK Enable Test
    	#------------------------------------------------------------------------------
    end
    

     

     

×
×
  • Create New...