#因为百度不能贴一次性太长的脚本
#请把分开了的脚本全部插入同一页在main之前
#===============================================================================
$width = 640 # Screen width (will not change resolution,
$height = 480 # Screen height here for compatibility)
$ov_zoom = 0.6 # Overworld zoom multiplier
$strip_size = 8 # Size of each strip of the map. Higher numbers will lag less.
# Recommended that this number be a power of 2.
# Do not make higher than 64.
$curve = true # Whether the map is curled, for overworlds (old method)
$data_map = load_data("Data/MapInfos.rxdata")
#===============================================================================
class RPG::MapInfo
def name # Definition prevents location scripts from reading anything within
return @name.gsub(/\[.*\]/) {""} # brackets, including the brackets
end
#-----------------------------------------------------------------------------
def original_name
return @name
end
#-----------------------------------------------------------------------------
def overworld?
return @name.scan(/[OV]/).size > 0
end
#-----------------------------------------------------------------------------
def pitch
@name =~ /\[#[ ]*([00-99]+)\]/i
return $1
end
end
#===============================================================================
class Draw_Tilemap # This class controls a set of sprites, with different Z
# values, arranged into horizontal bars
attr_accessor :tileset
attr_accessor :map_data
attr_accessor :priorities
attr_accessor :autotiles
attr_accessor :bitmaps
attr_accessor :pitch
attr_accessor :ox
attr_accessor :oy
attr_accessor :plus_y
INDEX = # Autotile definitions
[
26, 27, 32, 33, 4, 27, 32, 33, 26, 5, 32, 33, 4, 5, 32, 33,
26, 27, 32, 11, 4, 27, 32, 11, 26, 5, 32, 11, 4, 5, 32, 11,
26, 27, 10, 33, 4, 27, 10, 33, 26, 5, 10, 33, 4, 5, 10, 33,
26, 27, 10, 11, 4, 27, 10, 11, 26, 5, 10, 11, 4, 5, 10, 11,
24, 25, 30, 31, 24, 5, 30, 31, 24, 25, 30, 11, 24, 5, 30, 11,
14, 15, 20, 21, 14, 15, 20, 11, 14, 15, 10, 21, 14, 15, 10, 11,
28, 29, 34, 35, 28, 29, 10, 35, 4, 29, 34, 35, 4, 29, 10, 35,
38, 39, 44, 45, 4, 39, 44, 45, 38, 5, 44, 45, 4, 5, 44, 45,
24, 29, 30, 35, 14, 15, 44, 45, 12, 13, 18 ,19, 12, 13, 18, 11,
16, 17, 22, 23, 16, 17, 10, 23, 40, 41, 46, 47, 4, 41, 46, 47,
36, 37, 42, 43, 36, 5, 42, 43, 12, 17, 18, 23, 12, 13, 42, 43,
36, 41, 42, 47, 16, 17, 46, 47, 12, 17, 42, 47, 0, 1, 6, 7
]
X = [0, 1, 0, 1] # Used in 16x16 autotile drawing; left, right, left, right
Y = [0, 0, 1, 1] # Used in 16x16 autotile drawing; up, up, down, down
#-----------------------------------------------------------------------------
def initialize
# Get initial data from Game_Map
@tileset = RPG::Cache.tileset($game_map.tileset_name)
@map_data = $game_map.data
@priorities = $game_map.priorities
@autotiles = []
for i in 0..6
@autotiles[i] = RPG::Cache.autotile($game_map.autotile_names[i])
end
# Provide blank data in proper object form
@ox = 0
@oy = 0
# Bitmaps used for each priority's drawing. Priorities 2-5 are combined.
@bitmaps = [Bitmap.new($game_map.width*32, $game_map.height*32+$strip_size),
Bitmap.new($game_map.width*32, $game_map.height*32+$strip_size),
Bitmap.new($game_map.width*32, $game_map.height*32+$strip_size)]
# Generate blank sprites
@sprites = [[], [], []]
for i in 0..2 # For each layer
for j in 0..$game_map.height * (32 / $strip_size) - 1
# For each horizontal strip of $strip_size height, make a blank sprite
@sprites[i].push(Sprite.new)
@sprites[i][j].bitmap = Bitmap.new($game_map.width*32, $strip_size*2)
@sprites[i][j].x = $width / 2
@sprites[i][j].y = -64
@sprites[i][j].z = -5 + (i * 10)
end
end
@disposed = false
draw
end
#-----------------------------------------------------------------------------
def update
# Retrieve variable values for slant drawing; these values accesible by event
@pitch = $game_map.pitch.to_f
@plus_y = $game_map.plus_y
for i in 0..2 # For each layer
for j in [0, (($height / 2) - (($height * 60) /
@pitch) + @oy) / $strip_size].max.to_i..[@sprites[i].size - 1,
(@oy + $height) / $strip_size].min.to_i
# For each strip within the visible screen, update OX/Y
@sprites[i][j].x = $width / 2
@sprites[i][j].y = j * $strip_size - @oy
unless @pitch == 0 # Apply X Zoom
@sprites[i][j].zoom_x = (@sprites[i][j].y - $height / 2) *
(@pitch / ($height * 25)) + 1
if $curve # Zoom Y values same as X, and compensate
@sprites[i][j].zoom_y = @sprites[i][j].zoom_x
@sprites[i][j].y += $strip_size * (1 - @sprites[i][j].zoom_y) *
((1 - @sprites[i][j].zoom_y) /
(2 * ((@pitch / 100) /
($height / ($strip_size * 2)))) + 0.5)
end
end
@sprites[i][j].ox = @ox + $width / 2
# Add plus_y value; used in airship script
@sprites[i][j].y += @plus_y
end
end
end