1+ #==============================================================================
2+ # ** Scene_Title
3+ #------------------------------------------------------------------------------
4+ # This class performs title screen processing.
5+ #==============================================================================
6+
7+ class Scene_Title
8+ #--------------------------------------------------------------------------
9+ # * Main Processing
10+ #--------------------------------------------------------------------------
11+ def main
12+ if $BTEST
13+ battle_test
14+ return
15+ end
16+ $data_actors = load_data ( "Data/Actors.rxdata" )
17+ $data_classes = load_data ( "Data/Classes.rxdata" )
18+ $data_skills = load_data ( "Data/Skills.rxdata" )
19+ $data_items = load_data ( "Data/Items.rxdata" )
20+ $data_weapons = load_data ( "Data/Weapons.rxdata" )
21+ $data_armors = load_data ( "Data/Armors.rxdata" )
22+ $data_enemies = load_data ( "Data/Enemies.rxdata" )
23+ $data_troops = load_data ( "Data/Troops.rxdata" )
24+ $data_states = load_data ( "Data/States.rxdata" )
25+ $data_animations = load_data ( "Data/Animations.rxdata" )
26+ $data_tilesets = load_data ( "Data/Tilesets.rxdata" )
27+ $data_common_events = load_data ( "Data/CommonEvents.rxdata" )
28+ $data_system = load_data ( "Data/System.rxdata" )
29+ $game_system = Game_System . new
30+ @sprite = Sprite . new
31+ @sprite . bitmap = RPG ::Cache . title ( $data_system. title_name )
32+ @menu_labels = [ "New Game" , "Continue" , "Shutdown" ]
33+ @menu_windows = [ ]
34+ menu_w = 160
35+ menu_h = 56
36+ menu_margin = 24
37+ total_w = @menu_labels . size * menu_w + ( @menu_labels . size - 1 ) * menu_margin
38+ start_x = 320 - total_w / 2
39+ y = 380
40+ for i in 0 ...@menu_labels . size
41+ win = Window_Base . new ( start_x + i * ( menu_w + menu_margin ) , y , menu_w , menu_h )
42+ win . opacity = 200
43+ win . back_opacity = 160
44+ win . contents = Bitmap . new ( menu_w - 32 , menu_h - 32 )
45+ win . contents . font . color = Window_Base . new ( 0 , 0 , 0 , 0 ) . normal_color
46+ win . contents . draw_text ( 0 , 0 , win . contents . width , win . contents . height , @menu_labels [ i ] , 1 )
47+ @menu_windows << win
48+ end
49+ @continue_enabled = false
50+ for i in 0 ..3
51+ if FileTest . exist? ( "Save#{ i +1 } .rxdata" )
52+ @continue_enabled = true
53+ end
54+ end
55+ @menu_index = @continue_enabled ? 1 : 0
56+ refresh_menu_highlight
57+ $game_system. bgm_play ( $data_system. title_bgm )
58+ Audio . me_stop
59+ Audio . bgs_stop
60+ Graphics . transition
61+ loop do
62+ Graphics . update
63+ Input . update
64+ update
65+ if $scene != self
66+ break
67+ end
68+ end
69+ Graphics . freeze
70+ for win in @menu_windows
71+ win . dispose
72+ end
73+ @sprite . bitmap . dispose
74+ @sprite . dispose
75+ end
76+ #--------------------------------------------------------------------------
77+ # * Frame Update
78+ #--------------------------------------------------------------------------
79+ def update
80+ last_index = @menu_index
81+ moved = false
82+ if Input . repeat? ( Input ::RIGHT )
83+ @menu_index = ( @menu_index + 1 ) % @menu_labels . size
84+ moved = true if @menu_index != last_index
85+ elsif Input . repeat? ( Input ::LEFT )
86+ @menu_index = ( @menu_index - 1 + @menu_labels . size ) % @menu_labels . size
87+ moved = true if @menu_index != last_index
88+ end
89+ if moved
90+ $game_system. se_play ( $data_system. cursor_se )
91+ refresh_menu_highlight
92+ end
93+
94+ if Input . trigger? ( Input ::C )
95+ case @menu_index
96+ when 0
97+ command_new_game
98+ when 1
99+ command_continue
100+ when 2
101+ command_shutdown
102+ end
103+ end
104+ end
105+
106+ def refresh_menu_highlight
107+ for i in 0 ...@menu_windows . size
108+ if i == @menu_index
109+ @menu_windows [ i ] . contents . font . color = Window_Base . new ( 0 , 0 , 0 , 0 ) . text_color ( 6 )
110+ else
111+ @menu_windows [ i ] . contents . font . color = Window_Base . new ( 0 , 0 , 0 , 0 ) . normal_color
112+ end
113+ @menu_windows [ i ] . contents . clear
114+ @menu_windows [ i ] . contents . draw_text ( 0 , 0 , @menu_windows [ i ] . contents . width , @menu_windows [ i ] . contents . height , @menu_labels [ i ] , 1 )
115+ end
116+ end
117+ #--------------------------------------------------------------------------
118+ # * Command: New Game
119+ #--------------------------------------------------------------------------
120+ def command_new_game
121+ $game_system. se_play ( $data_system. decision_se )
122+ Audio . bgm_stop
123+ Graphics . frame_count = 0
124+ $game_temp = Game_Temp . new
125+ $game_system = Game_System . new
126+ $game_switches = Game_Switches . new
127+ $game_variables = Game_Variables . new
128+ $game_self_switches = Game_SelfSwitches . new
129+ $game_screen = Game_Screen . new
130+ $game_actors = Game_Actors . new
131+ $game_party = Game_Party . new
132+ $game_troop = Game_Troop . new
133+ $game_map = Game_Map . new
134+ $game_player = Game_Player . new
135+ $game_party. setup_starting_members
136+ $game_map. setup ( $data_system. start_map_id )
137+ $game_player. moveto ( $data_system. start_x , $data_system. start_y )
138+ $game_player. refresh
139+ $game_map. autoplay
140+ $game_map. update
141+ $scene = Scene_Map . new
142+ end
143+ #--------------------------------------------------------------------------
144+ # * Command: Continue
145+ #--------------------------------------------------------------------------
146+ def command_continue
147+ unless @continue_enabled
148+ $game_system. se_play ( $data_system. buzzer_se )
149+ return
150+ end
151+ $game_system. se_play ( $data_system. decision_se )
152+ $scene = Scene_Load . new
153+ end
154+ #--------------------------------------------------------------------------
155+ # * Command: Shutdown
156+ #--------------------------------------------------------------------------
157+ def command_shutdown
158+ $game_system. se_play ( $data_system. decision_se )
159+ Audio . bgm_fade ( 800 )
160+ Audio . bgs_fade ( 800 )
161+ Audio . me_fade ( 800 )
162+ $scene = nil
163+ end
164+ #--------------------------------------------------------------------------
165+ # * Battle Test
166+ #--------------------------------------------------------------------------
167+ def battle_test
168+ $data_actors = load_data ( "Data/BT_Actors.rxdata" )
169+ $data_classes = load_data ( "Data/BT_Classes.rxdata" )
170+ $data_skills = load_data ( "Data/BT_Skills.rxdata" )
171+ $data_items = load_data ( "Data/BT_Items.rxdata" )
172+ $data_weapons = load_data ( "Data/BT_Weapons.rxdata" )
173+ $data_armors = load_data ( "Data/BT_Armors.rxdata" )
174+ $data_enemies = load_data ( "Data/BT_Enemies.rxdata" )
175+ $data_troops = load_data ( "Data/BT_Troops.rxdata" )
176+ $data_states = load_data ( "Data/BT_States.rxdata" )
177+ $data_animations = load_data ( "Data/BT_Animations.rxdata" )
178+ $data_tilesets = load_data ( "Data/BT_Tilesets.rxdata" )
179+ $data_common_events = load_data ( "Data/BT_CommonEvents.rxdata" )
180+ $data_system = load_data ( "Data/BT_System.rxdata" )
181+ Graphics . frame_count = 0
182+ $game_temp = Game_Temp . new
183+ $game_system = Game_System . new
184+ $game_switches = Game_Switches . new
185+ $game_variables = Game_Variables . new
186+ $game_self_switches = Game_SelfSwitches . new
187+ $game_screen = Game_Screen . new
188+ $game_actors = Game_Actors . new
189+ $game_party = Game_Party . new
190+ $game_troop = Game_Troop . new
191+ $game_map = Game_Map . new
192+ $game_player = Game_Player . new
193+ $game_party. setup_battle_test_members
194+ $game_temp. battle_troop_id = $data_system. test_troop_id
195+ $game_temp. battle_can_escape = true
196+ $game_map. battleback_name = $data_system. battleback_name
197+ $game_system. se_play ( $data_system. battle_start_se )
198+ $game_system. bgm_play ( $game_system. battle_bgm )
199+ $scene = Scene_Battle . new
200+ end
201+ end
0 commit comments