mirror of
https://forgejo.xatacraft.ru/Sunshine/mkxp-sunshine.git
synced 2026-08-20 22:09:55 +00:00
Fast travel more or less finished
This commit is contained in:
parent
ddc43b2114
commit
21450179c6
8 changed files with 75 additions and 34 deletions
|
|
@ -15,6 +15,7 @@ class FastTravel
|
|||
:apartments => tr("apartments"),
|
||||
:cafe => tr("cafe"),
|
||||
:office => tr("office"),
|
||||
:obsdeck => tr("observation deck"),
|
||||
}),
|
||||
:green => Zone.new(tr("The Glen"), {
|
||||
:whatever => tr(""),
|
||||
|
|
|
|||
|
|
@ -214,7 +214,7 @@ class Ed_Message
|
|||
end
|
||||
|
||||
if visible
|
||||
if Input.trigger?(Input::ACTION)
|
||||
if Input.trigger?(Input::ACTION) || Input.trigger?(Input::CANCEL)
|
||||
terminate_message
|
||||
@fade_out_text = true
|
||||
end
|
||||
|
|
|
|||
|
|
@ -37,7 +37,15 @@ class FastTravel
|
|||
self.visible = true
|
||||
self.opacity = 0
|
||||
@fade_in = true
|
||||
@data = $game_fasttravel.unlocked_maps.sort
|
||||
@data = $game_fasttravel.unlocked_maps.keys.sort
|
||||
|
||||
# Set cursor to current map
|
||||
@data.each_with_index do |map, i|
|
||||
if $game_fasttravel.unlocked_maps[map].id == $game_map.map_id
|
||||
@index = i
|
||||
break
|
||||
end
|
||||
end
|
||||
zone = ZONES[$game_fasttravel.zone]
|
||||
|
||||
# Create title
|
||||
|
|
@ -119,6 +127,23 @@ class FastTravel
|
|||
$game_system.se_play($data_system.cursor_se)
|
||||
end
|
||||
|
||||
if Input.trigger?(Input::ACTION)
|
||||
$game_system.se_play($data_system.decision_se)
|
||||
choice = $game_fasttravel.unlocked_maps[@data[@index]]
|
||||
if choice.id != $game_map.map_id
|
||||
$game_temp.player_transferring = true
|
||||
$game_temp.player_new_map_id = choice.id
|
||||
$game_temp.player_new_x = choice.x
|
||||
$game_temp.player_new_y = choice.y
|
||||
$game_temp.player_new_direction = choice.dir
|
||||
Graphics.freeze
|
||||
$game_temp.transition_processing = true
|
||||
$game_temp.transition_name = "travel"
|
||||
end
|
||||
@fade_out = true
|
||||
return
|
||||
end
|
||||
|
||||
if Input.trigger?(Input::CANCEL)
|
||||
$game_system.se_play($data_system.cancel_se)
|
||||
@fade_out = true
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ class Game_Event < Game_Character
|
|||
attr_reader :list # list of event commands
|
||||
attr_reader :starting # starting flag
|
||||
attr_reader :collision # collision array
|
||||
attr_reader :x
|
||||
attr_reader :y
|
||||
#--------------------------------------------------------------------------
|
||||
# * Object Initialization
|
||||
# map_id : map ID
|
||||
|
|
|
|||
|
|
@ -3,20 +3,34 @@ class Game_FastTravel
|
|||
attr_accessor :enabled
|
||||
alias :enabled? :enabled
|
||||
|
||||
class Map
|
||||
attr_reader :id
|
||||
attr_reader :x
|
||||
attr_reader :y
|
||||
attr_reader :dir
|
||||
|
||||
def initialize(id, x, y, dir)
|
||||
@id = id
|
||||
@x = x
|
||||
@y = y
|
||||
@dir = dir
|
||||
end
|
||||
end
|
||||
|
||||
def initialize
|
||||
@unlocked = {}
|
||||
@zone = nil
|
||||
@enabled = false
|
||||
end
|
||||
|
||||
def unlock(map)
|
||||
@unlocked[@zone] << map
|
||||
def unlock(map, id, x, y, dir)
|
||||
@unlocked[@zone][map] = Map.new(id, x, y, dir)
|
||||
end
|
||||
|
||||
def zone=(zone)
|
||||
@zone = zone
|
||||
unless @unlocked.include? zone
|
||||
@unlocked[zone] = []
|
||||
@unlocked[zone] = {}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -124,8 +124,6 @@ class Scene_Map
|
|||
end
|
||||
# Hide icon when item menu is visible
|
||||
@item_icon.visible = !@item_menu.visible
|
||||
# Update fast travel
|
||||
@fast_travel.update
|
||||
# If game over
|
||||
if $game_temp.gameover
|
||||
# Switch to game over screen
|
||||
|
|
@ -150,6 +148,8 @@ class Scene_Map
|
|||
$game_temp.transition_name)
|
||||
end
|
||||
end
|
||||
# Update fast travel
|
||||
@fast_travel.update
|
||||
# If showing message window
|
||||
if $game_temp.message_window_showing || @ed_message.visible
|
||||
return
|
||||
|
|
@ -342,13 +342,13 @@ class Scene_Map
|
|||
# Update map (run parallel process event)
|
||||
$game_map.update
|
||||
@spriteset.update
|
||||
# If processing transition
|
||||
if $game_temp.transition_processing
|
||||
# Clear transition processing flag
|
||||
$game_temp.transition_processing = false
|
||||
# Execute transition
|
||||
Graphics.transition(20)
|
||||
end
|
||||
# # If processing transition
|
||||
# if $game_temp.transition_processing
|
||||
# # Clear transition processing flag
|
||||
# $game_temp.transition_processing = false
|
||||
# # Execute transition
|
||||
# Graphics.transition(20)
|
||||
# end
|
||||
# Run automatic change for BGM and BGS set on the map
|
||||
$game_map.autoplay
|
||||
# Frame reset
|
||||
|
|
|
|||
|
|
@ -122,15 +122,28 @@ def enable_travel
|
|||
end
|
||||
|
||||
def disable_travel
|
||||
$game_fasttravel.disabled = true
|
||||
$game_fasttravel.enabled = false
|
||||
end
|
||||
|
||||
def set_zone(zone)
|
||||
def unlock_map(zone, map, dir)
|
||||
# Find the coordinate of the calling event
|
||||
e = $game_map.events.values.find { |e| e.name == 'FAST TRAVEL' }
|
||||
raise 'could not find event named FAST TRAVEL' if !e
|
||||
case dir
|
||||
when :down
|
||||
newdir = 2
|
||||
when :left
|
||||
newdir = 4
|
||||
when :right
|
||||
newdir = 6
|
||||
when :up
|
||||
newdir = 8
|
||||
else
|
||||
raise "invalid direction: #{dir}"
|
||||
end
|
||||
$game_fasttravel.enabled = true
|
||||
$game_fasttravel.zone = zone
|
||||
end
|
||||
|
||||
def unlock_map(map)
|
||||
$game_fasttravel.unlock(map)
|
||||
$game_fasttravel.unlock(map, $game_map.map_id, e.x, e.y, newdir)
|
||||
end
|
||||
|
||||
# Misc
|
||||
|
|
|
|||
|
|
@ -97,20 +97,6 @@ class Window_MainMenu < Window_Selectable
|
|||
return
|
||||
end
|
||||
|
||||
# Update subwindows
|
||||
#if @item_window.active
|
||||
# @item_window.update
|
||||
# if Input.trigger?(Input::CANCEL)
|
||||
# $game_system.se_play($data_system.cancel_se)
|
||||
# self.active = true
|
||||
# self.opacity = 255
|
||||
# @item_window.visible = false
|
||||
# @item_window.active = false
|
||||
# @item_help_window.visible = false
|
||||
# return
|
||||
# end
|
||||
#end
|
||||
|
||||
# Don't do anything if not active
|
||||
if !self.active
|
||||
return
|
||||
|
|
|
|||
Loading…
Reference in a new issue