Class: Scene_Map

Inherits:
Scene_Base show all
Defined in:
Scene_Map.rb

Overview

** Scene_Map


This class performs the map screen processing.

Instance Method Summary (collapse)

Methods inherited from Scene_Base

#check_gameover, #create_main_viewport, #dispose_all_windows, #dispose_main_viewport, #fadeout_all, #main, #post_start, #return_scene, #scene_changing?, #update_all_windows, #update_basic

Instance Method Details

- (Object) call_menu


  • Call Menu Screen




189
190
191
192
193
# File 'Scene_Map.rb', line 189

def call_menu
  Sound.play_ok
  SceneManager.call(Scene_Menu)
  Window_MenuCommand::init_command_position
end

- (Object) create_all_windows


  • Create All Windows




140
141
142
143
144
# File 'Scene_Map.rb', line 140

def create_all_windows
  create_message_window
  create_scroll_text_window
  create_location_window
end

- (Object) create_location_window


  • Create Map Name Window




160
161
162
# File 'Scene_Map.rb', line 160

def create_location_window
  @map_name_window = Window_MapName.new
end

- (Object) create_message_window


  • Create Message Window




148
149
150
# File 'Scene_Map.rb', line 148

def create_message_window
  @message_window = Window_Message.new
end

- (Object) create_scroll_text_window


  • Create Scrolling Text Window




154
155
156
# File 'Scene_Map.rb', line 154

def create_scroll_text_window
  @scroll_text_window = Window_ScrollText.new
end

- (Object) create_spriteset


  • Create Sprite Set




128
129
130
# File 'Scene_Map.rb', line 128

def create_spriteset
  @spriteset = Spriteset_Map.new
end

- (Object) dispose_spriteset


  • Free Sprite Set




134
135
136
# File 'Scene_Map.rb', line 134

def dispose_spriteset
  @spriteset.dispose
end

- (Object) fade_loop(duration)


  • General-Purpose Fade Processing




95
96
97
98
99
100
# File 'Scene_Map.rb', line 95

def fade_loop(duration)
  duration.times do |i|
    yield 255 * (i + 1) / duration
    update_for_fade
  end
end

- (Object) fadein(duration)


  • Fadein Screen




104
105
106
# File 'Scene_Map.rb', line 104

def fadein(duration)
  fade_loop(duration) {|v| Graphics.brightness = v }
end

- (Object) fadein_speed


  • Get Fade In Speed




267
268
269
# File 'Scene_Map.rb', line 267

def fadein_speed
  return 30
end

- (Object) fadeout(duration)


  • Fadeout Screen




110
111
112
# File 'Scene_Map.rb', line 110

def fadeout(duration)
  fade_loop(duration) {|v| Graphics.brightness = 255 - v }
end

- (Object) fadeout_speed


  • Get Fade Out Speed




261
262
263
# File 'Scene_Map.rb', line 261

def fadeout_speed
  return 30
end

- (Object) fadeout_speed_to_title


  • Get Fade Out Speed for Title Screen Transition




273
274
275
# File 'Scene_Map.rb', line 273

def fadeout_speed_to_title
  return 60
end

- (Object) perform_battle_transition


  • Execute Pre-Battle Transition




254
255
256
257
# File 'Scene_Map.rb', line 254

def perform_battle_transition
  Graphics.transition(60, "Graphics/System/BattleStart", 100)
  Graphics.freeze
end

- (Object) perform_transfer


  • Player Transfer Processing




203
204
205
206
207
# File 'Scene_Map.rb', line 203

def perform_transfer
  pre_transfer
  $game_player.perform_transfer
  post_transfer
end

- (Object) perform_transition


  • Execute Transition

    Performs a fade in when the screen has been blacked out, such as
    immediately after a battle or load.



26
27
28
29
30
31
32
33
# File 'Scene_Map.rb', line 26

def perform_transition
  if Graphics.brightness == 0
    Graphics.transition(0)
    fadein(fadein_speed)
  else
    super
  end
end

- (Object) post_transfer


  • Post Processing for Transferring Player




223
224
225
226
227
228
229
230
231
232
233
# File 'Scene_Map.rb', line 223

def post_transfer
  case $game_temp.fade_type
  when 0
    Graphics.wait(fadein_speed / 2)
    fadein(fadein_speed)
  when 1
    Graphics.wait(fadein_speed / 2)
    white_fadein(fadein_speed)
  end
  @map_name_window.open
end

- (Object) pre_battle_scene


  • Preprocessing for Battle Screen Transition




237
238
239
240
241
242
243
244
# File 'Scene_Map.rb', line 237

def pre_battle_scene
  Graphics.update
  Graphics.freeze
  @spriteset.dispose_characters
  BattleManager.save_bgm_and_bgs
  BattleManager.play_battle_bgm
  Sound.play_battle_start
end

- (Object) pre_terminate


  • Pre-Termination Processing




43
44
45
46
47
# File 'Scene_Map.rb', line 43

def pre_terminate
  super
  pre_battle_scene if SceneManager.scene_is?(Scene_Battle)
  pre_title_scene  if SceneManager.scene_is?(Scene_Title)
end

- (Object) pre_title_scene


  • Preprocessing for Title Screen Transition




248
249
250
# File 'Scene_Map.rb', line 248

def pre_title_scene
  fadeout(fadeout_speed_to_title)
end

- (Object) pre_transfer


  • Preprocessing for Transferring Player




211
212
213
214
215
216
217
218
219
# File 'Scene_Map.rb', line 211

def pre_transfer
  @map_name_window.close
  case $game_temp.fade_type
  when 0
    fadeout(fadeout_speed)
  when 1
    white_fadeout(fadeout_speed)
  end
end

- (Boolean) scene_change_ok?


  • Determine if Scene Transition Is Possible


Returns:

  • (Boolean)


71
72
73
# File 'Scene_Map.rb', line 71

def scene_change_ok?
  !$game_message.busy? && !$game_message.visible
end

- (Object) start


  • Start Processing




11
12
13
14
15
16
17
18
19
20
# File 'Scene_Map.rb', line 11

def start
  super
  SceneManager.clear
  $game_player.straighten
  $game_map.refresh
  $game_message.visible = false
  create_spriteset
  create_all_windows
  @menu_calling = false
end

- (Object) terminate


  • Termination Processing




51
52
53
54
55
56
# File 'Scene_Map.rb', line 51

def terminate
  super
  SceneManager.snapshot_for_background
  dispose_spriteset
  perform_battle_transition if SceneManager.scene_is?(Scene_Battle)
end

- (Object) transition_speed


  • Get Transition Speed




37
38
39
# File 'Scene_Map.rb', line 37

def transition_speed
  return 15
end

- (Object) update


  • Frame Update




60
61
62
63
64
65
66
67
# File 'Scene_Map.rb', line 60

def update
  super
  $game_map.update(true)
  $game_player.update
  $game_timer.update
  @spriteset.update
  update_scene if scene_change_ok?
end

- (Object) update_call_debug


  • Determine if Debug Call by F9 key




197
198
199
# File 'Scene_Map.rb', line 197

def update_call_debug
  SceneManager.call(Scene_Debug) if $TEST && Input.press?(:F9)
end

- (Object) update_call_menu


  • Determine if Menu is Called due to Cancel Button




178
179
180
181
182
183
184
185
# File 'Scene_Map.rb', line 178

def update_call_menu
  if $game_system.menu_disabled || $game_map.interpreter.running?
    @menu_calling = false
  else
    @menu_calling ||= Input.trigger?(:B)
    call_menu if @menu_calling && !$game_player.moving?
  end
end

- (Object) update_encounter


  • Update Encounter




172
173
174
# File 'Scene_Map.rb', line 172

def update_encounter
  SceneManager.call(Scene_Battle) if $game_player.encounter
end

- (Object) update_for_fade


  • Update Frame (for Fade In)




87
88
89
90
91
# File 'Scene_Map.rb', line 87

def update_for_fade
  update_basic
  $game_map.update(false)
  @spriteset.update
end

- (Object) update_scene


  • Update Scene Transition




77
78
79
80
81
82
83
# File 'Scene_Map.rb', line 77

def update_scene
  check_gameover
  update_transfer_player unless scene_changing?
  update_encounter unless scene_changing?
  update_call_menu unless scene_changing?
  update_call_debug unless scene_changing?
end

- (Object) update_transfer_player


  • Update Player Transfer




166
167
168
# File 'Scene_Map.rb', line 166

def update_transfer_player
  perform_transfer if $game_player.transfer?
end

- (Object) white_fadein(duration)


  • Screen Fade In (White)




116
117
118
# File 'Scene_Map.rb', line 116

def white_fadein(duration)
  fade_loop(duration) {|v| @viewport.color.set(255, 255, 255, 255 - v) }
end

- (Object) white_fadeout(duration)


  • Screen Fade Out (White)




122
123
124
# File 'Scene_Map.rb', line 122

def white_fadeout(duration)
  fade_loop(duration) {|v| @viewport.color.set(255, 255, 255, v) }
end