class Game_Time
def initialize
#Current Time = Hour, Minute, Second
@hour, @minute, @second = OS::T_StartHour, OS::T_StartMinute, 0
#Current Time = Day, Month, Year
@day, @month, @year = OS::T_StartDay, OS::T_StartMonth, OS::T_StartYear
#Speeds
@sbase = OS::T_Speed
@sfast = OS::T_Speed * 10
@sslow = OS::T_Speed / 10
@speed = @sbase
#Switches and 0's
@frame = 0
@reverse = false
@pause = false
@pm = false
#Tint
@tone = create_new_tone
$game_screen.start_tone_change(@tone,1)
end
def time?
string = sprintf("%02d:%02d:%02d", hour?, @minute, @second)
string += " #{@month}-#{@day}-#{@year}"
return string
end
def hour?(base=12)
if base == 24
return @hour
elsif base == 12
return @hour > OS::T_MaxHours ? @hour - 12 : @hour
else
return 0
end
end
def create_new_tone
case @hour
when 1
return Tone.new(-90,-90,-90,0)
when 2
return Tone.new(-80,-80,-80,0)
when 3
return Tone.new(-70,-70,-70,0)
when 4
return Tone.new(-60,-60,-60,0)
when 5
return Tone.new(-50,-50,-50,0)
when 6
return Tone.new(-40,-40,-40,0)
when 7
return Tone.new(-30,-30,-30,0)
when 8
return Tone.new(-20,-20,-20,0)
when 9
return Tone.new(-10,-10,-10,0)
when 10
return Tone.new(0,0,0,0)
when 11
return Tone.new(10,10,10,0)
when 12
return Tone.new(20,20,20,0)
when 13
return Tone.new(10,10,10,0)
when 14
return Tone.new(0,0,0,0)
when 15
return Tone.new(-10,-10,-10,0)
when 16
return Tone.new(-20,-20,-20,0)
when 17
return Tone.new(-30,-30,-30,0)
when 18
return Tone.new(-40,-40,-40,0)
when 19
return Tone.new(-50,-50,-50,0)
when 20
return Tone.new(-60,-60,-60,0)
when 21
return Tone.new(-70,-70,-70,0)
when 22
return Tone.new(-80,-80,-80,0)
when 23
return Tone.new(-90,-90,-90,0)
when 24
return Tone.new(-100,-100,-100,0)
end
end
def update
if @reverse
update_back
else
update_forward
end
return
end
def update_back
@frame += 1
if @frame == @speed
@frame = 0
@second -= 1
end
if @second == 0
@second = OS::T_MaxSeconds
@minute -= 1
end
if @minute == 0
@minute = OS::T_MaxMinutes
@hour -= 1
end
if @hour == 0
@hour = OS::T_MaxHours
end
@tone = create_new_tone
$game_screen.start_tone_change(@tone,1)
type = $game_world.weather.type
power = $game_world.weather.power
$game_screen.weather(type, power, rand(19)+1)
return
end
def update_forward
@frame += 1
if @frame == @speed
@frame = 0
@second += 1
end
if @second == OS::T_MaxSeconds
@second = 0
@minute += 1
end
if @minute == OS::T_MaxMinutes
@minute = 1
@hour += 1
end
if @hour == OS::T_MaxHours
@hour = 1
@day = new_day
end
if @day[0] = OS::T_Days[OS::T_Days.size - 1]
@day[0] = OS::T_Days[0]
@day[1] += 1
end
#if @day[1] == OS::T_Months[OS::T_Months.index(@month)][1]
#@day[1] = 1
#@month = OS::T_Months[OS::T_Months.index(@month)+1]
#end
#if @month == OS::T_Months[OS::T_Months.size - 1]
#@month = OS::T_Months[0]
#@year += 1
#end
@tone = create_new_tone
$game_screen.start_tone_change(@tone,1)
type = $game_world.weather.type
power = $game_world.weather.power
$game_screen.weather(type, power, rand(19)+1)
return
end
end