#======================#
# > CMS #5 #
# > By Rune #
# > Ver. 1 #
#======================#
#---------------------Window_Base---------------------
#---------------------Battler display---------------------
class Window_Base
def draw_actor_battler(actor, x, y, opacity)
bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
end
#---------------------Name + Class display---------------------
def draw_actor_name_menu(actor, x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 160, 32, actor.name, 1)
end
def draw_actor_class(actor, x, y)
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 160, 32, actor.class_name, 1)
end
#---------------------Level display---------------------
def draw_actor_level(actor, x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, "Lv:")
self.contents.font.color = normal_color
self.contents.draw_text(x + 24, y, 24, 32, actor.level.to_s, 2)
end
#---------------------EXP display---------------------
def draw_actor_exp(actor, x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 608 / 4, 32, "EXP")
self.contents.font.color = normal_color
self.contents.draw_text(x - 16, y + 16, 84, 32, actor.exp_s, 2)
self.contents.draw_text(x + 68, y + 16, 12, 32, "/", 1)
self.contents.draw_text(x + 80, y + 16, 84, 32, actor.next_exp_s)
end
#---------------------Equipment display---------------------
def draw_item_name_menu(item, x, y)
if item == nil
return
end
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = normal_color
self.contents.draw_text(x + 28, y, 608 / 4 - 28, 32, item.name)
end
end
#---------------------Window_MenuStatus---------------------
class Window_MenuStatus < Window_Selectable
def initialize
super(0, 0, 640, 480)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
self.active = false
self.index = -1
end
def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
x = i * 608 / 4
y = 0
actor = $game_party.actors[i]
draw_actor_graphic(actor, x + 12, y + 64)
draw_actor_battler(actor, x + 75, y + 256, 160)
self.contents.font.size = 28
self.contents.font.name = "Monotype Corsiva"
draw_actor_name_menu(actor, x - 10, y)
self.contents.font.size = 24
draw_actor_class(actor, x - 10, y + 32)
draw_actor_level(actor, x + 2, y + 64)
draw_actor_state(actor, x + 50, y + 64)
draw_actor_hp(actor, x + 2, y + 208)
draw_actor_sp(actor, x + 2, y + 224)
draw_actor_exp(actor, x + 2, y + 240)
self.contents.draw_text(0, 270, 608, 32, "=========================================================================================================================")
draw_item_name_menu($data_weapons[actor.weapon_id], x + 2, y + 288)
draw_item_name_menu($data_armors[actor.armor1_id], x + 2, y + 320)
draw_item_name_menu($data_armors[actor.armor2_id], x + 2, y + 352)
draw_item_name_menu($data_armors[actor.armor3_id], x + 2, y + 384)
draw_item_name_menu($data_armors[actor.armor4_id], x + 2, y + 416)
end
end
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(@index * 608 / 4, 0, 608 / 4, self.height - 32)
end
if Input.repeat?(Input::RIGHT)
if (@column_max == 1 and Input.trigger?(Input::RIGHT)) or
@index < @item_max - @column_max
$game_system.se_play($data_system.cursor_se)
@index = (@index + @column_max) % @item_max
end
end
if Input.repeat?(Input::LEFT)
if (@column_max == 1 and Input.trigger?(Input::LEFT)) or
@index >= @column_max
$game_system.se_play($data_system.cursor_se)
@index = (@index - @column_max + @item_max) % @item_max
end
end
end
end
#---------------------Window_Gold---------------------
class Window_Gold < Window_Base
def initialize
super(0, 0, 160, 96)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
self.contents.clear
self.contents.font.color = normal_color
self.contents.font.name = "Monotype Corsiva"
self.contents.font.size = 24
self.contents.draw_text(0, 32, 128, 32, $game_party.gold.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 128, 32, $data_system.words.gold)
end
end
#---------------------Window_PlayTime---------------------
class Window_PlayTime
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.font.name = "Monotype Corsiva"
self.contents.font.size = 24
self.contents.draw_text(4, 0, 120, 32, "Play Time")
@total_sec = Graphics.frame_count / Graphics.frame_rate
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
text = sprintf("%02d:%02d:%02d", hour, min, sec)
self.contents.font.color = normal_color
self.contents.draw_text(4, 32, 120, 32, text, 2)
end
end
#---------------------Window_Command---------------------
class Window_Command
def refresh
self.contents.clear
for i in 0...@item_max
self.contents.font.name = "Monotype Corsiva"
self.contents.font.size = 24
draw_item(i, normal_color)
end
end
end
#---------------------Window_Location---------------------
$data_mapinfos = load_data('Data/MapInfos.rxdata')
class Window_Location < Window_Base
def initialize
super(0, 0, 320, 64)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
self.contents.clear
self.contents.font.name = "Monotype Corsiva"
self.contents.font.size = 24
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 80, 32, "Location:")
self.contents.font.color = normal_color
name = $data_mapinfos[$game_map.map_id].name
self.contents.draw_text(96, 0, 192, 32, name)
end
end
#---------------------Window_GameName---------------------
class Window_GameName < Window_Base
def initialize
super(0, 0, 320, 64)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
self.contents.clear
self.contents.font.name = "Monotype Corsiva"
self.contents.font.size = 24
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 288, 32, "Insert Name Of Game", 1)
end
end
#---------------------Scene_Menu---------------------
class Scene_Menu
def initialize(menu_index = 0)
@menu_index = menu_index
end
def main
s1 = $data_system.words.item
s2 = $data_system.words.skill
s3 = $data_system.words.equip
s4 = "Status"
s5 = "Save Game"
s6 = "End Game"
@status_window = Window_MenuStatus.new
@status_window.x = 0
@status_window.y = 0
@status_window.contents_opacity = 44
@playtime_window = Window_PlayTime.new
@playtime_window.x = 160
@playtime_window.y = 320
@playtime_window.visible = true
@gold_window = Window_Gold.new
@gold_window.x = 320
@gold_window.y = 320
@gold_window.visible = true
@loc_window = Window_Location.new
@loc_window.x = 0
@loc_window.y = 416
@loc_window.visible = true
@gn_window = Window_GameName.new
@gn_window.x = 320
@gn_window.y = 416
@gn_window.visible = true
@command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
@command_window.index = @menu_index
@command_window.x = 240
@command_window.y = 128
@command_window.height = 32 * 6 + 1
@command_window.visible = true
if $game_party.actors.size == 0
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
end
if $game_system.save_disabled
@command_window.disable_item(4)
end
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@command_window.dispose
@loc_window.dispose
@gn_window.dispose
@playtime_window.dispose
@gold_window.dispose
@status_window.dispose
end
def update
@command_window.update
@loc_window.update
@gn_window.update
@playtime_window.update
@gold_window.update
@status_window.update
if @command_window.active
update_command
return
end
if @status_window.active
update_status
return
end
end
def update_command
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::C)
if $game_party.actors.size == 0 and @command_window.index < 4
$game_system.se_play($data_system.buzzer_se)
return
end
case @command_window.index
when 0
$game_system.se_play($data_system.decision_se)
$scene = Scene_Item.new
when 1
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@command_window.visible = false
@gold_window.visible = false
@playtime_window.visible = false
@loc_window.visible = false
@gn_window.visible = false
@status_window.contents_opacity = 256
@status_window.active = true
@status_window.index = 0
when 2
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@command_window.visible = false
@gold_window.visible = false
@playtime_window.visible = false
@loc_window.visible = false
@gn_window.visible = false
@status_window.contents_opacity = 256
@status_window.active = true
@status_window.index = 0
when 3
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@command_window.visible = false
@gold_window.visible = false
@playtime_window.visible = false
@loc_window.visible = false
@gn_window.visible = false
@status_window.contents_opacity = 256
@status_window.active = true
@status_window.index = 0
when 4
if $game_system.save_disabled
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = Scene_Save.new
when 5
$game_system.se_play($data_system.decision_se)
$scene = Scene_End.new
end
return
end
end
def update_status
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@command_window.active = true
@command_window.visible = true
@gold_window.visible = true
@playtime_window.visible = true
@loc_window.visible = true
@gn_window.visible = true
@status_window.contents_opacity = 64
@status_window.active = false
@status_window.index = -1
return
end
if Input.trigger?(Input::C)
case @command_window.index
when 1
if $game_party.actors[@status_window.index].restriction >= 2
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = Scene_Skill.new(@status_window.index)
when 2
$game_system.se_play($data_system.decision_se)
$scene = Scene_Equip.new(@status_window.index)
when 3
$game_system.se_play($data_system.decision_se)
$scene = Scene_Status.new(@status_window.index)
end
return
end
end
end