#==============================================================================
# ** Menù ad anello
#------------------------------------------------------------------------------
# Creato da Syvkal
# Versione 1.2
# 03-04-2012
# Tradotto in Ita da Yoshi91
# Modificato per Beccacorvo da Zocchina
#------------------------------------------------------------------------------
# * La versione originale su:
# www.rpgmakervxace.net e forums.rpgmakerweb.com
# Perfavore non re-distribuire in inglese o in italiano questo script.
#------------------------------------------------------------------------------
# * Termini per l'uso
# Disponibile anche per giochi commerciali, e Syvkal ne vorrà una versione
# gratutita :P
# L'indirizzo E-Mail di Syvkal: [email protected]<script cf-hash='f9e31' type="text/javascript">
/* */</script>
#==============================================================================
#
# - INTRODUZIONE -
#
# Questo script introduce un nuovo menù a forma di anello, altamente
# personalizzabile. Creato per VX Ace.
# Inoltre aggiunge la funzione "Carica salvataggio" al menù.
#------------------------------------------------------------------------------
#
# - Istruzioni per l'uso -
#
# Ogni comando del menù necessita di un'icona che deve situarsi nella cartella
# Pictures del vostro progetto.
# Questa dovrà misurare in Pixel 48x48.
#
# Il file dell'icona si deve necessariamente chiamare con il nome del comando
# a cui verrà associata.
# Così si dovrà chiamare il file:
#
# Nome comando Icona
#
# Al posto di Nome comando andrà il nome del comando settato da voi nel database.
# E il vocabolo Icona va come scritto nell'esempio, lettera maiuscola iniziale.
# Esempio: Per l'icona Status, se in Database -> Glossario (o l'ultimo comando
# del database) ho settato "Stato", il file lo dovrò denominare 'Stato Icona'.
# Ricordati di lasciare lo spazio fra icona e nome comando!
# In ogni caso, puoi controllare come devi chiamare l'icona dal messaggio di
# errore che segnalerà la mancanza del File.
#
# Inoltre lo script necessita dell'icona di "comando disabilitato" e "carica
# salvataggio". (vedi a riga 91 per saperne di più sul "comando disabilitato")
#------------------------------------------------------------------------------
#
# - COMPABILITà -
#
# Questo Script ridefinisce le seguenti righe:
# * create_status_window (Scene_Menu)
# * on_formation_ok (Scene_Menu)
# * on_formation_cancel (Scene_Menu)
# * draw_character (Window_Base)
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
# Questo script "aliasia" le seguenti righe:
# * add_save_command (Window_MenuCommand)
# * start (Scene_Menu)
# * create_command_window (Scene_Menu)
# * command_personal (Scene_Menu)
# * command_formation (Scene_Menu)
# * on_personal_cancel (Scene_Menu)
#
#==============================================================================
#===================================================#
# ** I N I Z I O C O N F I G U R A Z I O N I ** #
#===================================================#
#--------------------------------------------------------------------------
# * Frames dell'animazione iniziale
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Setta la quantità di Frames da sfruttare per l'animazione iniziale del menù.
# PS: è consigliato lasciare a 20.
#--------------------------------------------------------------------------
STARTUP_FRAMES = 20
#--------------------------------------------------------------------------
# * Frames dell'animazione del movimento
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Setta la quantità di Frames da sfruttare per l'animazione di movimento
# comandi del menù. PS: è consigliato lasciare a 15.
#--------------------------------------------------------------------------
MOVING_FRAMES = 15
#--------------------------------------------------------------------------
# * Ampiezza del menù Anello
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Setta la grandezza del menù.
#--------------------------------------------------------------------------
RING_R = 75
#--------------------------------------------------------------------------
# * Mostra comandi disabilitati
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Setta su false se vuoi che i comandi disattivati vengano nascosti, su true
# se vuoi che vengano mostrati; in questo modo verranno comunque bloccati se
# settato da te, e appena il giocatore si sposterà sul comando disabilitato
# noterà l'icona che indica "inaccessibile" (vedi prossime righe)
# Si possono ad esempio bloccare Salva e Formazione tramite eventi.
#--------------------------------------------------------------------------
DISABLED_SHOW = true
#--------------------------------------------------------------------------
# * Icona per comandi disabilitati
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# L'icona che verrà mostrata ai comandi bloccati
# (verrà usata solo se a DISABLED_SHOW = ci sarà true, però è obbligatorio
# inserirne una anche se DISABLED_SHOW = sarà a false.
#--------------------------------------------------------------------------
ICON_DISABLE = Cache::picture('DisableIcon') # scrivila in mezzo alle '
#--------------------------------------------------------------------------
# * Salta selezione eroe se da solo
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Questa funzione utile permette di saltare la selezione dell'eroe se è da
# solo. (per Abilità, Equipaggia e Status). Esempio:
# Se setto ACTOR_SKIP = true, quando ho in squadra un solo eroe e seleziono
# "Equipaggia", mi manderà subito al menù di equip. dell'unico eroe.
# E quando si aggiungono nuovi eroi alla squadra, ad "Equipaggia" mi farà
# prima scegliere l'eroe a cui dovrò cambiare armi e armature.
# Se setto ACTOR_SKIP = false, mi farà sempre scegliere prima l'eroe da
# cambiare, anche se unico.
#--------------------------------------------------------------------------
ACTOR_SKIP = true
#--------------------------------------------------------------------------
# * Nome del comando Carica salvataggio
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Setta fra le due " il nome del comando "Carica salvataggio"
#--------------------------------------------------------------------------
Vocab::Load = "Carica"
#########################################################
# PS. Puoi cambiare la parola "Posizione" alla riga 440!#
#########################################################
#===================================================#
# ** F I N E C O N F I G U R A Z I O N I ** #
#===================================================#
################################################################################
# Attenzione! Modificare le righe seguenti potrebbe causare errori!
################################################################################
module Ring_Menu
def initialize(*args)
super(*args)
@cx = contents.width / 2; @cy = contents.height / 2
self.opacity = 0
@startup = STARTUP_FRAMES
@icons = []
@mode = :start
@steps = @startup
end
def update_cursor
end
def animation?
return @mode != :wait
end
def cursor_down(wrap)
cursor_right(wrap)
end
def cursor_up(wrap)
cursor_left(wrap)
end
def cursor_right(wrap)
unless animation?
select((index + 1) % item_max)
@mode = :mover
@steps = MOVING_FRAMES
Sound.play_cursor
end
end
def cursor_left(wrap)
unless animation?
select((index - 1 + item_max) % item_max)
@mode = :movel
@steps = MOVING_FRAMES
Sound.play_cursor
end
end
def update
super
refresh if animation?
end
def refresh
self.contents.clear
case @mode
when :start
refresh_start
when :wait
refresh_wait
when :mover
refresh_move(1)
when :movel
refresh_move(0)
end
end
def refresh_start
d1 = 2.0 * Math::PI / item_max
d2 = 1.0 * Math::PI / @startup
r = RING_R - 1.0 * RING_R * @steps / @startup
for i in 0...item_max
d = d1 * i + d2 * @steps
x = @cx + ( r * Math.sin( d ) ).to_i
y = @cy - ( r * Math.cos( d ) ).to_i
draw_item(x, y, i)
end
@steps -= 1
if @steps < 0
@mode = :wait
end
end
def refresh_wait
d = 2.0 * Math::PI / item_max
for i in 0...item_max
j = i - index
x = @cx + ( RING_R * Math.sin( d * j) ).to_i
y = @cy - ( RING_R * Math.cos( d * j) ).to_i
draw_item(x, y, i)
end
end
def refresh_move( mode )
d1 = 2.0 * Math::PI / item_max
d2 = d1 / MOVING_FRAMES
d2 *= -1 unless mode != 0
for i in 0...item_max
j = i - index
d = d1 * j + d2 * @steps
x = @cx + ( RING_R * Math.sin( d ) ).to_i
y = @cy - ( RING_R * Math.cos( d ) ).to_i
draw_item(x, y, i)
end
@steps -= 1
if @steps < 0
@mode = :wait
end
end
end
class Window_MenuCommand < Window_Command
include Ring_Menu
alias add_save_command_ring_menu_original add_save_command
def initialize
super(0, 0)
unless DISABLED_SHOW
@list.delete_if {|i| !i[:enabled]}
end
for i in 0...item_max
@icons.push(Cache::picture(command_name(i) + ' Icona'))
end
if @@last_command_symbol != nil
index = @list.index(@@last_command_symbol)
@mode = :wait
end
select_last
refresh
end
def refresh
super
rect = Rect.new(0, 196, self.contents.width, line_height)
draw_text(rect, command_name(index), 1)
end
def window_width
return 544
end
def window_height
return 416
end
def add_save_command
add_save_command_ring_menu_original
add_command(Vocab::Load, :load)
end
def draw_item(x, y, i)
rect = Rect.new(0, 0, @icons[i].width, @icons[i].height)
if i == index
self.contents.blt(x - rect.width/2, y - rect.height/2, @icons[i], rect )
unless command_enabled?(index)
self.contents.blt(x - rect.width/2, y - rect.height/2, ICON_DISABLE, rect )
end
else
self.contents.blt(x - rect.width/2, y - rect.height/2, @icons[i], rect, 128 )
end
end
end
class Window_RingStatus < Window_Selectable
include Ring_Menu
attr_accessor :pending_index
attr_accessor :pending
def initialize
super(0, 0, 544, 416)
self.hide
@mode = :wait
@pending_index = -1
@pending = false
refresh
end
def refresh
super
rect = Rect.new(0, 196, self.contents.width, line_height)
draw_text(rect, $game_party.members[index].name, 1)
end
def item_max
$game_party.members.size
end
def refresh_move( mode )
unless pending_index >= 0
super
else
d = 2.0 * Math::PI / item_max
for i in 0...item_max
j = i - pending_index
x = @cx + ( RING_R * Math.sin( d * j) ).to_i
y = @cy - ( RING_R * Math.cos( d * j) ).to_i
draw_item(x, y, i)
end
@mode = :wait
end
end
def draw_item(x, y, i)
if i == index && !(@pending && @pending_index < 0)
draw_character($game_party.members[i].character_name,
$game_party.members[i].character_index , x, y, true, true)
else
draw_character($game_party.members[i].character_name,
$game_party.members[i].character_index , x, y, false, true)
end
end
def process_ok
super
$game_party.menu_actor = $game_party.members[index] unless pending
end
def select_last
select($game_party.members.index($game_party.menu_actor) || 0)
refresh
end
end
class Scene_Menu < Scene_MenuBase
alias start_ring_original start
alias create_command_window_ring_menu_original create_command_window
alias command_personal_ring_original command_personal
alias command_formation_ring_original command_formation
alias on_personal_cancel_ring_original on_personal_cancel
def start
start_ring_original
end
def create_command_window
create_command_window_ring_menu_original
@command_window.set_handler(:load, method(:command_load))
end
def create_status_window
@status_window = Window_RingStatus.new
end
def command_personal
if $game_party.members.size < 2 && ACTOR_SKIP
on_personal_ok
else
@command_window.hide
@status_window.show
command_personal_ring_original
end
end
def command_formation
@status_window.pending = true
@command_window.hide
command_formation_ring_original
@status_window.index = 0
@status_window.refresh
@status_window.show
end
def command_load
SceneManager.call(Scene_Load)
end
def on_personal_cancel
@status_window.hide
on_personal_cancel_ring_original
@status_window.deactivate
@command_window.show
end
def on_formation_ok
if @status_window.pending_index >= 0
$game_party.swap_order(@status_window.index,
@status_window.pending_index)
@status_window.index = @status_window.pending_index
@status_window.pending_index = -1
else
@status_window.pending_index = @status_window.index
end
@status_window.refresh
@status_window.activate
end
def on_formation_cancel
if @status_window.pending_index >= 0
@status_window.index = @status_window.pending_index
@status_window.pending_index = -1
@status_window.activate
@status_window.refresh
else
@status_window.pending = false
@status_window.hide
@status_window.select_last
@status_window.deactivate
@command_window.show
@command_window.activate
end
end
end
class Window_Base < Window
def draw_character(character_name, character_index, x, y, enabled = true, centred = false)
return if character_name == nil
bitmap = Cache.character(character_name)
sign = character_name[/^[\!\$]./]
if sign && sign.include?('$')
cw = bitmap.width / 3
ch = bitmap.height / 4
else
cw = bitmap.width / 12
ch = bitmap.height / 8
end
n = character_index
src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
self.contents.blt(x - cw / 2, centred ? y - ch/2 : y - ch, bitmap, src_rect,
enabled ? 255 : 128)
end
end
class Scene_Menu < Scene_MenuBase
def create_gold_window
#@gold_window = Window_Gold.new
#@gold_window.x = 0
#@gold_window.y = Graphics.height - @gold_window.height
end
end