def update
@interpreter.update
@status_windows.each {|win| win.update(@actor_index)}
@target_windows.each {|win| win.update(@target_index)}
@info_window.update
unless @status_windows[0].x < 0 || @status_windows[0].dir != 0 ||
@target_windows[0] != nil && @target_windows[0].dir != 0
@command_window.update
[@help_window, @equips_window, @item_choose_window, @sort_window,
@skill_window, @left_window, @right_window, @playerstatus_window,
@options_window, @end_window].each {|win| win.update if win != nil}
end
move_da_main if @status_windows[0].x < 0
move_da_selection if @status_windows[0].dir != 0
move_da_targeting if @target_windows[0] != nil && @target_windows[0].dir != 0
move_da_status if @playerstatus_window != nil && @playerstatus_window.y > 0
move_da_equip if @left_window != nil && @left_window.x > 0
move_da_skill if @skill_window != nil && @skill_window.x < 256
move_da_target if @target_windows[0] != nil && @target_windows[0].x < 0
move_da_items if @item_choose_window != nil && @item_choose_window.y < 0
move_da_sort if @sort_window != nil && @sort_window.y < 64
move_da_equipment if @equips_window != nil && @equips_window.y < 64
move_da_options if @options_window != nil && @options_window.y > 0
move_da_end if @end_window != nil && @end_window.y > 336
if @moved
@moved = false
return
end
if @equips_window != nil
update_equipment
elsif @command_window.active
update_command
elsif @status_windows[0].active
update_status
elsif @item_choose_window != nil
if @item_choose_window.active
items_refresh
update_items_choose
elsif @sort_window != nil && @sort_window.active
update_sort
elsif @items_window1 != nil && @items_window1.active
@items_window1.update
update_item
elsif @items_window2 != nil && @items_window2.active
@items_window2.update
update_item
elsif @target_windows[0] != nil && @target_windows[0].active
update_item_target
end
elsif @skill_window != nil && @skill_window.active
update_skill
elsif @target_windows[0] != nil && @target_windows[0].active
update_skill_target
elsif @right_window != nil
if @right_window.active
update_right_equip
elsif @item_window != nil && @item_window.active
@item_window.update
update_eitem
end
elsif @playerstatus_window != nil && @playerstatus_window.active
update_playerstatus
elsif @options_window != nil && @options_window.active
update_options
elsif @end_window != nil
update_end
end
end
def move_windows(wins, border, mdiff, lead, xy, acc = false)
if acc
diff = [[((xy ? lead.x : lead.y)-border).abs, mdiff].min, 1].max
else
diff = [[((xy ? lead.x : lead.y)-border).abs/2, mdiff].min, 1].max
end
wins[0].each {|win| win.x += diff if win != nil}
wins[1].each {|win| win.x -= diff if win != nil}
wins[2].each {|win| win.y += diff if win != nil}
wins[3].each {|win| win.y -= diff if win != nil}
@moved = true
end
def move_da_main
lead = @status_windows[0]
x_plus = @status_windows
x_minus = [@command_window]
y_minus = [@info_window]
move_windows([x_plus, x_minus, [], y_minus], 0, 128, lead, true)
end
def move_da_outro
@flag = true
lead = @status_windows[0]
x_plus = [@command_window]
x_minus = @status_windows + @target_windows + [@skill_window, @help_window]
y_plus = [@info_window]
y_minus = [@item_choose_window, @items_window1, @items_window2, @help_window]
move_windows([x_plus, x_minus, y_plus, y_minus], 0, 128, lead, true, true)
end
def move_da_selection(lead = @status_windows[@actor_index])
if lead.dir == 1
move_windows([[], [], [], @status_windows], 360, 32, lead, false)
else
move_windows([[], [], @status_windows, []], 0, 32, lead, false)
end
end
def move_da_targeting(lead = @target_windows[@target_index])
if lead.dir == 1
move_windows([[], [], [], @target_windows], 376, 32, lead, false)
else
move_windows([[], [], @target_windows, []], 64, 32, lead, false)
end
end
def move_da_sort(win = @sort_window)
move_windows([[], [], [win], []], 64, 32, win, false)
end
def move_da_status(win = @playerstatus_window)
move_windows([[], [], [], [win]], 0, 64, win, false)
end
def move_da_equip(win = @left_window)
x_minus = [@left_window, @right_window, @help_window] + @item_windows
move_windows([[], x_minus, [], []], 0, 64, win, true)
end
def move_da_skill(win = @skill_window)
x_plus = [@skill_window, @help_window]
move_windows([x_plus, [], [], []], 256, 64, win, true)
end
def move_da_target(win = @target_windows[0])
move_windows([@target_windows, [], [], []], 0, 32, win, true)
end
def move_da_items(win = @item_choose_window)
y_plus = [@item_choose_window, @items_window1, @items_window2, @help_window]
move_windows([[], [], y_plus, []], 0, 64, win, false)
end
def move_da_equipment(win = @equips_window)
y_plus = [@equips_window, @help_window]
move_windows([[], [], y_plus, []], 64, 64, win, false)
end
def move_da_options(win = @options_window)
move_windows([[], [], [], [win]], 0, 64, win, false)
end
def move_da_end(win = @end_window)
move_windows([[], [], [], [win]], 336, 64, win, false)
end
def update_command
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@scene = Scene_Map.new
elsif Input.trigger?(Input::C)
if $game_party.actors.size == 0 && @command_window.index < 5
$game_system.se_play($data_system.buzzer_se)
return
end
case @command_window.index
when 0
$game_system.se_play($data_system.decision_se)
if BlizzCFG::CUSTOM_ITEM_SCENE
@scene = Scene_Item.new
else
@item_choose_window = Window_CMSChooseItem.new
@items_window1 = Window_NormalItem.new
@items_window2 = Window_QuestItem.new
@items_window1.help_window = @items_window2.help_window = @help_window
@command_window.active = false
@help_window.x, @help_window.y = 0, -576
@help_window.set_text('')
@help_window.visible = false
items_refresh
end
when 1..4
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_windows.each {|win| win.active = true}
@actor_index = 0
when 5
$game_system.se_play($data_system.decision_se)
if BlizzCFG::CUSTOM_OPTIONS_SCENE
@scene = Scene_Options.new
else
@scene = Scene_Map.new
#@options_window = Window_CMSOptions.new
#@command_window.active = false
end
when 6
if $game_system.save_disabled
$game_system.se_play($data_system.buzzer_se)
else
$game_system.se_play($data_system.decision_se)
@scene = Scene_CMSSave.new
Graphics.transition(0)
end
when 7
if @command_window.continue
$game_system.se_play($data_system.decision_se)
@scene = Scene_CMSLoad.new
Graphics.transition(0)
else
$game_system.se_play($data_system.buzzer_se)
end
when 8
$game_system.se_play($data_system.decision_se)
if BlizzCFG::CUSTOM_END_SCENE
@scene = Scene_End.new
else
@command_window.active = false
@end_window = Window_CMSEndCommand.new
end
end
end
end