mirror of
https://forgejo.xatacraft.ru/Sunshine/mkxp-sunshine.git
synced 2026-08-19 21:39:57 +00:00
some map features
This commit is contained in:
parent
999176c19b
commit
697ff6f977
2 changed files with 49 additions and 3 deletions
|
|
@ -23,6 +23,12 @@ class Game_Map
|
|||
attr_accessor :battleback_name # battleback file name
|
||||
attr_accessor :display_x # display x-coordinate * 128
|
||||
attr_accessor :display_y # display y-coordinate * 128
|
||||
attr_accessor :display_clip_bottom
|
||||
attr_accessor :display_clip_left
|
||||
attr_accessor :display_clip_right
|
||||
attr_accessor :display_clip_top
|
||||
attr_accessor :display_x_fix
|
||||
attr_accessor :display_y_fix
|
||||
attr_accessor :wrap_x # display x-coordinate * 128 for wrap
|
||||
attr_accessor :wrap_y # display y-coordinate * 128 for wrap
|
||||
attr_accessor :need_refresh # refresh request flag
|
||||
|
|
@ -83,6 +89,12 @@ class Game_Map
|
|||
@map_id = 0
|
||||
@display_x = 0
|
||||
@display_y = 0
|
||||
@display_clip_bottom = 999999
|
||||
@display_clip_left = 0
|
||||
@display_clip_right = 999999
|
||||
@display_clip_top = 0
|
||||
@display_x_fix = nil
|
||||
@display_y_fix = nil
|
||||
end
|
||||
#--------------------------------------------------------------------------
|
||||
# * Setup
|
||||
|
|
@ -118,6 +130,12 @@ class Game_Map
|
|||
# Initialize displayed coordinates
|
||||
@display_x = 0
|
||||
@display_y = 0
|
||||
@display_clip_bottom = 999999
|
||||
@display_clip_left = 0
|
||||
@display_clip_right = 999999
|
||||
@display_clip_top = 0
|
||||
@display_x_fix = nil
|
||||
@display_y_fix = nil
|
||||
@wrap_x = 0
|
||||
@wrap_y = 0
|
||||
# Clear refresh request flag
|
||||
|
|
@ -263,36 +281,48 @@ class Game_Map
|
|||
# distance : scroll distance
|
||||
#--------------------------------------------------------------------------
|
||||
def scroll_down(distance)
|
||||
return if @display_y_fix
|
||||
|
||||
if self.height < Graphics.height / 28
|
||||
@display_y = self.height / 2
|
||||
else
|
||||
@display_y = [@display_y + distance, (self.height - Graphics.height / 28) * 128].min
|
||||
end
|
||||
@display_y = @display_y.clamp((@display_clip_top * 128.0).to_i, (@display_clip_bottom * 128.0).to_i - Graphics.height * 4)
|
||||
end
|
||||
#--------------------------------------------------------------------------
|
||||
# * Scroll Left
|
||||
# distance : scroll distance
|
||||
#--------------------------------------------------------------------------
|
||||
def scroll_left(distance)
|
||||
return if @display_x_fix
|
||||
|
||||
@display_x = [@display_x - distance, 0].max
|
||||
@display_x = @display_x.clamp((@display_clip_left * 128.0).to_i, (@display_clip_right * 128.0).to_i - Graphics.width * 4)
|
||||
end
|
||||
#--------------------------------------------------------------------------
|
||||
# * Scroll Right
|
||||
# distance : scroll distance
|
||||
#--------------------------------------------------------------------------
|
||||
def scroll_right(distance)
|
||||
return if @display_x_fix
|
||||
|
||||
@display_x = [@display_x + distance, (self.width - (Graphics.width / 32)) * 128].min
|
||||
@display_x = @display_x.clamp((@display_clip_left * 128.0).to_i, (@display_clip_right * 128.0).to_i - Graphics.width * 4)
|
||||
end
|
||||
#--------------------------------------------------------------------------
|
||||
# * Scroll Up
|
||||
# distance : scroll distance
|
||||
#--------------------------------------------------------------------------
|
||||
def scroll_up(distance)
|
||||
return if @display_y_fix
|
||||
|
||||
if self.height < Graphics.height / 28
|
||||
@display_y = self.height / 2
|
||||
else
|
||||
@display_y = [@display_y - distance, 0].max
|
||||
end
|
||||
@display_y = @display_y.clamp((@display_clip_top * 128.0).to_i, (@display_clip_bottom * 128.0).to_i - Graphics.height * 4)
|
||||
end
|
||||
#--------------------------------------------------------------------------
|
||||
# * Determine Valid Coordinates
|
||||
|
|
@ -486,6 +516,11 @@ class Game_Map
|
|||
# * Frame Update
|
||||
#--------------------------------------------------------------------------
|
||||
def update
|
||||
@display_clip_top = @display_clip_top || 0
|
||||
@display_clip_left = @display_clip_left || 0
|
||||
@display_clip_right = @display_clip_right || 999999
|
||||
@display_clip_bottom = @display_clip_bottom || 999999
|
||||
|
||||
# Refresh map if necessary
|
||||
if $game_map.need_refresh
|
||||
refresh
|
||||
|
|
@ -535,6 +570,17 @@ class Game_Map
|
|||
@fog_opacity = (@fog_opacity * (d - 1) + @fog_opacity_target) / d
|
||||
@fog_opacity_duration -= 1
|
||||
end
|
||||
|
||||
if @display_x_fix
|
||||
@display_x = (@display_x_fix * 128.0).to_i - Graphics.width * 2
|
||||
else
|
||||
@display_x = @display_x.clamp((@display_clip_left * 128.0).to_i, (@display_clip_right * 128.0).to_i - Graphics.width * 4)
|
||||
end
|
||||
if @display_y_fix
|
||||
@display_y = (@display_y_fix * 128.0).to_i - Graphics.height * 2
|
||||
else
|
||||
@display_y = @display_y.clamp((@display_clip_top * 128.0).to_i, (@display_clip_bottom * 128.0).to_i - Graphics.height * 4)
|
||||
end
|
||||
end
|
||||
|
||||
def set_tile(x, y, z, tile)
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ class Scene_Title
|
|||
@cursor.zoom_x = @cursor.zoom_y = 2
|
||||
@cursor.z += 2
|
||||
@cursor.x = Graphics.width - MENU_X - 12
|
||||
@cursor.y = Graphics.height - MENU_Y + (ENTRY_HEIGHT - @cursor.bitmap.height) / 2 - 2
|
||||
@cursor.y = Graphics.height - MENU_Y + (ENTRY_HEIGHT - @cursor.bitmap.height) / 2 - 3
|
||||
|
||||
# Initialize cursor position
|
||||
@cursor_pos = 0.0
|
||||
|
|
@ -127,7 +127,7 @@ class Scene_Title
|
|||
@menu.x = w - MENU_X
|
||||
@menu.y = h - MENU_Y
|
||||
@cursor.x = w - MENU_X - 12
|
||||
@cursor.y = ((h - MENU_Y).to_f + (ENTRY_HEIGHT - @cursor.bitmap.height) / 2.0 + ENTRY_HEIGHT * @cursor_pos - 2)
|
||||
@cursor.y = ((h - MENU_Y).to_f + (ENTRY_HEIGHT - @cursor.bitmap.height) / 2.0 + ENTRY_HEIGHT * @cursor_pos - 3)
|
||||
|
||||
@sprite.x = w / 2
|
||||
@sprite.y = h / 2
|
||||
|
|
@ -198,7 +198,7 @@ class Scene_Title
|
|||
|
||||
# Handle cursor movement
|
||||
if !@window_settings_title.visible
|
||||
@cursor.y = ((Graphics.height - MENU_Y).to_f + (ENTRY_HEIGHT - @cursor.bitmap.height) / 2.0 + ENTRY_HEIGHT * @cursor_pos - 2) * 0.65 + @cursor.y.to_f * 0.35
|
||||
@cursor.y = ((Graphics.height - MENU_Y).to_f + (ENTRY_HEIGHT - @cursor.bitmap.height) / 2.0 + ENTRY_HEIGHT * @cursor_pos - 3) * 0.65 + @cursor.y.to_f * 0.35
|
||||
update_cursor = false
|
||||
if Input.trigger?(Input::UP)
|
||||
if @cursor_pos > 0
|
||||
|
|
|
|||
Loading…
Reference in a new issue