赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 7526 |
最后登录 | 2021-4-24 |
在线时间 | 31 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 59
- 在线时间
- 31 小时
- 注册时间
- 2009-1-30
- 帖子
- 207
|
6楼
楼主 |
发表于 2009-3-13 02:19:02
|
只看该作者
{/cy}用代理弄来了
- module Game
- #ゲーム画面の定義
- DISPLAY_WIDTH = 544
- DISPLAY_HEIGHT = 416
-
- #縦横チップ数の定義
- DISPLAY_CHIP_WIDTH = DISPLAY_WIDTH / 32
- DISPLAY_CHIP_HEIGHT = DISPLAY_HEIGHT / 32
-
- #実座標の定義(よくわからないがマップ座標 * 256が定義らしい)
- DISPLAY_REAL_WIDTH = DISPLAY_CHIP_WIDTH * 256
- DISPLAY_REAL_HEIGHT = DISPLAY_CHIP_HEIGHT * 256
-
- end
- #記述ルール
- #定義済みの処理への追加(元の処理を損ねない)
- #--------------------------------------------------------------------------
- # ● 処理
- #--------------------------------------------------------------------------
- #定義済みの処理を上書きする変更
- #--------------------------------------------------------------------------
- # ● 処理 (上書き)
- #--------------------------------------------------------------------------
- #新規処理
- #--------------------------------------------------------------------------
- # ○ 処理
- #--------------------------------------------------------------------------
复制代码
定数定義
- #タイルを並べられる
- class Rect
- def set_pos(x, y)
- self.x = x
- self.y = y
- end
- def set_size(w, h)
- self.width = w
- self.height = h
- end
- end
- #==============================================================================
- # ■ TileBitmap
- #------------------------------------------------------------------------------
- #
- #==============================================================================
- class TileBitmap < Bitmap
- def initialize(width, height, tilemap)
- super(width, height)
- @tilemap = tilemap
- @map_width = width / 32
- @map_height = height / 32
- @buffer = Bitmap.new(width, height)
- @map_x = 999
- @map_y = 999
- @anime_face = 0
- @anime_face_x = 0
- @anime_speed = 30
- @anime_count = @anime_speed
- @main_autotile = MainAutotile.new(self, @tilemap.bitmaps)
- @temprect = Rect.new(0,0,32,32)
- @range = -1..1
- end
-
- #--------------------------------------------------------------------------
- def dispose
- @buffer.dispose
- @main_autotile.dispose
- super
- end
- #--------------------------------------------------------------------------
- def set_tile(id, dx, dy)
- case id
- when 2048...2816
- set_auto_tile1(id - 2048, dx, dy)
- when 2816...4352
- chipid, atid = (id -2816).divmod(48)
- @main_autotile.draw(1,
- atid, (chipid & 7) << 6 , (chipid >> 3) * 96, dx, dy, chipid)
- when 4352...5888
- set_auto_tile2(@tilemap.bitmaps[2], id - 4352, dx, dy)
- when 5888...8000
- set_auto_tile2(@tilemap.bitmaps[3], id - 5888, dx, dy)
- when 1536...2048
- set_normal_tile(@tilemap.bitmaps[4], id - 1536, dx, dy)
- when 1...256
- #0は書き込まない
- set_normal_tile(@tilemap.bitmaps[5], id, dx, dy)
- when 256...512
- set_normal_tile(@tilemap.bitmaps[6], id - 256, dx, dy)
- when 512...768
- set_normal_tile(@tilemap.bitmaps[7], id - 512, dx, dy)
- when 768...1536
- set_normal_tile(@tilemap.bitmaps[8], id - 768, dx, dy)
- end
- end
-
- #--------------------------------------------------------------------------
- def set_normal_tile(bitmap, id, dx, dy)
- if(id < 128)
- @temprect.set((id & 7) << 5, id >> 3 << 5, 32, 32)
- else
- id = id - 128
- @temprect.set(((id & 7) + 8) << 5, id >> 3 << 5, 32, 32)
- end
- blt(dx, dy, bitmap, @temprect)
- end
- #--------------------------------------------------------------------------
- def set_auto_tile1(id, dx, dy)
- chip_id, atid = id.divmod(48)
- f = @anime_face
- fx = @anime_face_x
- case chip_id
- when 0
- @main_autotile.draw(0, atid, fx, 0, dx, dy, f)
- when 1
- @main_autotile.draw(0, atid, fx, 96, dx, dy, 8 + f)
- when 2
- @main_autotile.draw(0, atid, 192, 0, dx, dy, 3)
- # blt(dx, dy, @tilemap.bitmaps[0], Rect.new(192, 0, 32, 32))
- when 3
- blt(dx, dy, @tilemap.bitmaps[0], Rect.new(192, 96, 32, 32))
- when 4
- @main_autotile.draw(0, atid, 256 + fx, 0, dx, dy, f + 4)
- when 6
- @main_autotile.draw(0, atid, 256 + fx, 96, dx, dy, f + 12)
- when 8
- @main_autotile.draw(0, atid, fx, 192, dx, dy, f + 16)
- when 10
- @main_autotile.draw(0, atid, fx, 288, dx, dy, f + 20)
- when 12
- @main_autotile.draw(0, atid, 256 + fx, 192, dx, dy, f + 24)
- when 14
- @main_autotile.draw(0, atid, 256 + fx, 288, dx, dy, f + 28)
- end
-
- end
-
- #--------------------------------------------------------------------------
- # アニメーションタイルであればtrueを返す
- # Params: tile_id タイル番号
- # Return: アニメーションタイルであればTrue
- #--------------------------------------------------------------------------
- def anime_tile? (tile_id)
- return tile_id && tile_id.between?(2048, 2815)
- end
-
- #--------------------------------------------------------------------------
- def set_auto_tile2(bitmap, id, dx, dy)
- #オートタイルID
- autotile_id = id % 48
-
- #仮に八分割して表示
- real = id / 48
- @temprect.set((real & 7) << 5, real >> 3 << 5, 32, 32)
- blt(dx, dy, bitmap, @temprect)
- end
- #--------------------------------------------------------------------------
- # マップ上の座標からマップをセット
- #--------------------------------------------------------------------------
- def set_map(ox, oy)
- return update_anime(ox, oy) if @map_x == ox && @map_y == oy
- #誤差が1の時はバッファからマップをコピー、不足分のみ描画する
- #このときアニメカウント0ならアニメを更新する
- dir_x = ox - @map_x
- dir_y = oy - @map_y
- update_anime(ox - dir_x, oy - dir_y)
- #ループの考慮なし
- #マップWとdirxの絶対値が同じなら+ならー1ーなら1にする
- if @range === dir_x && @range === dir_y
- case
- when dir_x.zero? && dir_y == -1
- copy_from_buffer(Rect.new(0, 0, width, height - 32), 0, 32)
- #上端の一列を描く
- draw_map(0, 0, ox, oy,
- ox + @map_width, oy + 1)
- when dir_x.zero? && dir_y == 1
- copy_from_buffer(Rect.new(0, 32, width, height - 32), 0, 0)
- #下端の一列を描く
- draw_map(0, height - 32, ox, oy + @map_height - 1,
- ox + @map_width, oy + @map_height)
- when dir_y.zero? && dir_x == -1
- copy_from_buffer(Rect.new(0, 0, width - 32, height), 32, 0)
- #左端の一列を描く
- draw_map(0, 0, ox, oy,
- ox + 1, oy + @map_height)
- when dir_y.zero? && dir_x == 1
- copy_from_buffer(Rect.new(32, 0, width - 32, height), 0, 0)
- #右端の一列を描く
- draw_map(width - 32, 0, ox + @map_width - 1, oy,
- ox + @map_width, oy + @map_height)
- # when dir_y = -1 && dir_x = -1
- # when dir_y = -1 && dir_x = 1
- # when dir_y = 1 && dir_x = -1
- # when dir_y = 1 && dir_x = 1
- end
-
- else
- #全描画
- #アニメカウントを考慮すること
- clear
- draw_map(0, 0, ox, oy, ox + @map_width, oy + @map_height)
- end
- @map_x = ox
- @map_y = oy
- return true
- end
-
- def next_anime_face
- @anime_face = (@anime_face + 1) % 3
- @anime_face_x = @anime_face << 6
- end
-
-
- #--------------------------------------------------------------------------
- # バッファからコピー
- #ox,oy 左上の座標(関数内で画面外補正をかける)
- #--------------------------------------------------------------------------
- def update_anime(ox, oy)
- if @anime_count.zero?
- next_anime_face
- x = y = dx = dy = 0
- data = $game_map.data
- map_each(ox+3, oy, ox + @map_width-3, oy + @map_height) do |x, y, dx, dy|
- #レイヤー1のアニメタイルはアニメタイルの上にある
- #レイヤー2にアニメタイルは無い
- #よって0のみチェックすればよい
- if anime_tile?(data[x, y, 0])
- for z in 0..2
- tile_id = data[x, y, z]
- set_tile(tile_id, 96 + dx, dy) if tile_id
- end
- end
- end
-
- @anime_count = @anime_speed
- return true
- else
- @anime_count -= 1
- return false
- end
- end
-
- #--------------------------------------------------------------------------
- # バッファからコピー
- #--------------------------------------------------------------------------
- def copy_from_buffer(r, bx, by)
- @buffer.clear
- @buffer.blt(0, 0, self, self.rect)
- clear
- blt(bx, by, @buffer, r)
- end
- #--------------------------------------------------------------------------
- def draw_map(tox, toy, ox, oy, xmax, ymax)
- data = $game_map.data
- x = y = dx = dy = 0
- map_each(ox, oy, xmax, ymax) do |x, y, dx, dy|
- for z in 0..2
- tile_id = data[x, y, z]
- set_tile(tile_id, tox + dx, toy + dy) if tile_id
- end
- end
- end
-
- #--------------------------------------------------------------------------
- # マップの特定箇所に対して処理を行う
- # z軸については考慮しないため処理ブロック側で実装のこと
- # Params:
- # sx start_x
- # sy start_y
- # ex end_x
- # ey end_y
- # Yield: |x, y, dx, dy| マップのx,y、0から数えた描画先のx,y
- #--------------------------------------------------------------------------
- def map_each(sx, sy, ex, ey)
- mapw = $game_map.width
- maph = $game_map.height
- isv = $game_map.loop_vertical?
- ish = $game_map.loop_horizontal?
- draw_y = 0
- for y in sy...ey
- y = get_looped_point(y, maph) if isv
- draw_x = 0
- for x in sx...ex
- x = get_looped_point(x, mapw) if ish
- yield(x, y, draw_x, draw_y)
- draw_x += 32
- end
- draw_y += 32
- end
- end
-
- #ループを考慮して座標を取得(x,y対応)
- #val 現在位置 size マップサイズ
- #--------------------------------------------------------------------------
- def get_looped_point(val, size)
- return case
- when size <= val then val -= size
- when val < 0 then val += size
- else val
- end
- end
- end
复制代码
TileBitmap
- class TileSprite < Sprite
- def initialize(width, height, tilemap, viewport)
- super(viewport)
- self.bitmap = Bitmap.new(Game::DISPLAY_WIDTH, Game::DISPLAY_HEIGHT)
- self.x = 0
- self.y = 0
- self.ox = 0
- self.oy = 0
- self.z = 0
- @backbuffer = TileBitmap.new(width, height, tilemap)
- @bg = Sprite.new(viewport)
- @bg.z = 1
- @bg.blend_type = 1
- @bg.bitmap = Cache.picture('bg')
-
- @mapx = -999
- @mapy = -999
- @x_plus = (width - Game::DISPLAY_WIDTH) / 2
- @y_plus = 128 #(height - Game::DISPLAY_HEIGHT) / 2
-
- @draw_count = false
-
- @x_table = Table.new(416)
- @y_table = Table.new(416)
- set_render_table(45)
- end
- def dispose
- @bg.dispose if @bg
- @backbuffer.dispose if @backbuffer
- self.bitmap.dispose if self.bitmap
- super
- end
-
- def hide
- self.visible = false
- @bg.visible = false
- end
-
- def show
- self.visible = true
- @bg.visible = true
- end
-
- def set_render_table(angle)
- return false if angle == @angle
- @angle = angle
- d = 400.0
- rad = angle * Math::PI / 180
- sina = Math.sin(rad)
- cosa = Math.cos(rad)
- x_zoom = 272 * 1.5
- for i in 0...416
- sy = 208 - i
- unless angle == 90
- aaa = sy == 0 ? 0: (90 - angle) / 208.0 * sy
- aaa = sy < 0 ? 90 + aaa : 90 - aaa
- rad = aaa * Math::PI / 180
- sy = (sy / Math.sin(rad)) * (d + (sy * Math.cos(rad))) / d
- end
-
-
- to_y = sina.zero? ? -256: ((sy / sina) * (d + (sy * cosa)) / d).round
- #to_y = sina.zero? ? -256: ((sy / sina) * (d + (sy * cosa)) / d).round
- @y_table[i] = 208 - to_y
- #y=1のときのx
- to_x = (-x_zoom * (d + (sy * -cosa)) / d) + x_zoom
- @x_table[i] = - (272 * to_x / (272 - to_x )).round
- end
-
- #一応bgのサイズもかえとく
- #90が0で45が100
- case @angle
- when 45
- @bg.zoom_y = 1.0
- when 90
- @bg.zoom_y = 0.0
- else
- @bg.zoom_y = (1.0 / 45) * (90 - @angle)
- end
- @bg.opacity = 255 * @bg.zoom_y
- return true
- end
-
- #マップ上の座標で設定
- def update_map(ox, oy)
- return unless self.visible
- aox = ($game_map.display_x >> 3 & 31) + @x_plus
- aoy = ($game_map.display_y >> 3 & 31) + @y_plus
-
- ud = set_render_table($game_map.get_angle)
- sd = @backbuffer.set_map(ox, oy)
- return if !sd && !ud && aox == @mapx && aoy == @mapy
- update_bitmap(aox, aoy)
- end
-
- def update_bitmap(aox, aoy)
- @mapx = aox
- @mapy = aoy
- unless aox == @x_plus && aoy == @y_plus
- @draw_count = !@draw_count
- return if @draw_count
- end
-
- bmp = self.bitmap
- bmp.clear
-
- bmph = bmp.height
- bmpw = bmp.width
-
- yt = @y_table
- xt = @x_table
- bb = @backbuffer
- from_r = Rect.new(0, 0, 1 , 1)
- to_r = Rect.new(0, 0, bmpw, 1)
- i = 0
- while i < bmph
- to_y = yt[i]
- if to_y < -@y_plus
- i += 1
- next
- end
-
- to_x = xt[i]
- to_r.y = i
-
- ww = 0
- while i < bmph
- ww += 1
- i += 1
- break unless to_x == xt[i] && to_y + ww == yt[i]
- end
-
-
- to_r.height = ww
- from_r.set(to_x + aox, to_y + aoy, bmpw - to_x - to_x, ww)
- bmp.stretch_blt(to_r, bb, from_r)
- end
- end
-
-
- end
- class Game_Map
- #--------------------------------------------------------------------------
- # ● 公開インスタンス変数
- #--------------------------------------------------------------------------
- attr_accessor :mode3D
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- alias a9_003_initialize initialize
- def initialize
- a9_003_initialize
- @mode3D = false
- @angle3D = 45
- end
-
- #--------------------------------------------------------------------------
- def set_angle(v)
- @angle3D = v
- end
-
- #--------------------------------------------------------------------------
- def get_angle
- @angle3D
- end
-
- end
- class Spriteset_Map
- #--------------------------------------------------------------------------
- # ● ビューポートの作成
- #--------------------------------------------------------------------------
- alias a9_003_create_viewports create_viewports
- def create_viewports
- a9_003_create_viewports
- @viewport_invisible = Viewport.new(0, 0, 1, 1)
- @viewport_invisible.visible = false
- end
-
- #--------------------------------------------------------------------------
- # ● ビューポートの解放
- #--------------------------------------------------------------------------
- alias a9_003_dispose_viewports dispose_viewports
- def dispose_viewports
- a9_003_dispose_viewports
-
- @viewport_invisible.dispose
- end
- #--------------------------------------------------------------------------
- # ● タイルマップの作成
- #--------------------------------------------------------------------------
- alias a9_003_create_tilemap create_tilemap
- def create_tilemap
- a9_003_create_tilemap
- @tilemap.visible = false
- @tile_sprite = TileSprite.new(544+448, 416+128, @tilemap, @viewport1)
- end_3d
- end
-
- #--------------------------------------------------------------------------
- def begin_3d
- @tilemap.viewport = @viewport_invisible
- @mode3d = true
- @tile_sprite.show
- end
- #--------------------------------------------------------------------------
- def end_3d
- @tilemap.viewport = @viewport1
- @mode3d = false
- @tile_sprite.hide
- end
-
- #--------------------------------------------------------------------------
- # ● タイルマップの解放
- #--------------------------------------------------------------------------
- alias a9_003_dispose_tilemap dispose_tilemap
- def dispose_tilemap
- a9_003_dispose_tilemap
- @tile_sprite.dispose
- end
- #--------------------------------------------------------------------------
- # ● タイルマップの更新
- #--------------------------------------------------------------------------
- alias a9_003update_tilemap update_tilemap
- def update_tilemap
- g = $game_map
- unless g.mode3D == @mode3d
- @mode3d ? end_3d: begin_3d
- end
- unless @mode3d
- a9_003update_tilemap
- else
- @tile_sprite.update_map((g.display_x >> 8) - 7, (g.display_y >> 8) - 4)
- end
- end
- end
- #==============================================================================
- # ■ Game_Vehicle
- #------------------------------------------------------------------------------
- # 乗り物を扱うクラスです。このクラスは Game_Map クラスの内部で使用されます。
- # 現在のマップに乗り物がないときは、マップ座標 (-1,-1) に設定されます。
- #==============================================================================
- class Game_Vehicle < Game_Character
- #--------------------------------------------------------------------------
- # ● 乗り物に乗る
- #--------------------------------------------------------------------------
- alias a9_003_get_on get_on
- def get_on
- a9_003_get_on
- $game_map.mode3D = true if @type == 2 # 飛行船の場合
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新
- #--------------------------------------------------------------------------
- alias a9_003_update update
- def update
- a = @altitude
- a9_003_update
- update_angle(a)
- end
-
- #--------------------------------------------------------------------------
- def update_angle(alti)
- def set_angle
- $game_map.set_angle(90 - (45 / 8 * (@altitude / 4 + 1)))
- end
-
- if @type == 2 # 飛行船の場合
- if @driving
- if alti < MAX_ALTITUDE
- @altitude == MAX_ALTITUDE ? $game_map.set_angle(45): set_angle
- end
- elsif 0 < alti
- if @altitude.zero?
- $game_map.set_angle(90)
- $game_map.mode3D = false
- else
- set_angle
- end
-
- end
- end
-
- end
- end
复制代码
TileSprite
- #==============================================================================
- # ■ MainAutotile
- #------------------------------------------------------------------------------
- # Bitmapに海形式のオートタイルを描くクラス
- #==============================================================================
- class MainAutotile
- def initialize(parent, tilebitmaps)
- super()
- @parent = parent
- @bitmaps = tilebitmaps
- @rect = Rect.new(0, 0, 16, 16)
- # 01 buf0
- # 23 1
- # 45 2
- @lt_buffer = {0=>1, 4=>1, 6=>1, 8=>1, 12=>1, 19=>1, 23=>1, 32=>1, 33=>1}
- @lt_buf_0 = {0=>1, 4=>1, 6=>1, 8=>1, 12=>1}
- @lt_buf_1 = {19=>1, 32=>1}
- @lt_buf_2 = {23=>1,33=>1}
- @lt_1 = {1=>1, 3=>1, 5=>1, 7=>1, 9=>1, 11=>1, 13=>1,
- 15=>1, 26=>1, 27=>1, 29=>1, 31=>1, 39=>1}
- @lt_2 = {34=>1, 35=>1, 42=>1, 43=>1, 46=>1 }
- @lt_3 = {20=>1, 21=>1, 22=>1, 36=>1, 37=>1, 45=>1}#23, 33
- @lt_4 = {16=>1, 17=>1, 18=>1, 40=>1, 41=>1, 44=>1}#17..19, 32
- @lt_5 = {2=>1, 4=>1, 8=>1, 10=>1, 14=>1, 24=>1,
- 25=>1, 28=>1, 30=>1, 38=>1}#0, 6, 12
-
- @rt_buffer = {27=>1}
- @rt_height = {6=>1, 14=>1, 20=>1, 22=>1, 27=>1, 28=>1, 29=>1}#7
-
- @lb_buffer = {1=>1, 2=>1, 3=>1, 31=>1}
- @lb_width = {1=>1, 2=>1, 3=>1, 12=>1, 14=>1, 16=>1, 17=>1, 26=>1, 31=>1}
-
- make_buffer
- end
-
- #ox oy タイル側の転送元原点(海形式のタイルならなんにでも対応出来る)
- #--------------------------------------------------------------------------
- # メイン(海構成)のオートタイルを描く
- # Params:
- # bmpNo @tilemap.bitmapsの数値(通常0か1)
- # atid オートタイルID
- # ox 取得もとx
- # oy 取得もとy
- # dx 描画先x
- # dy 描画先y
- # bufid バッファID
- #--------------------------------------------------------------------------
- def draw(bmpNo, atid, ox, oy, dx, dy, bufid)
- r = @rect
- r.set_size(16, 16)
- b = @parent
- bw = bufid << 5
- bmps = rect = nil
- return if draw_lt(r, atid, ox, oy, bw) do |bmps, rect|
- b.blt(dx, dy, bmps[bmpNo], rect)
- end
-
- draw_rt(r, atid, ox, oy, bw) do |bmps, rect|
- b.blt(dx + 16, dy, bmps[bmpNo], rect)
- end
- return if draw_lb(r, atid, ox, oy, bw) do |bmps, rect|
- b.blt(dx, dy + 16, bmps[bmpNo], rect)
- end
- draw_rb(r, atid, ox, oy) do |bmps, rect|
- b.blt(dx + 16, dy + 16, bmps[bmpNo], rect)
- end
- end
- #--------------------------------------------------------------------------
- def dispose
- @buffers.each do |v|
- v.dispose
- end
- end
-
- #--------------------------------------------------------------------------
- private
-
- #--------------------------------------------------------------------------
- def make_buffer
- @buffers = []
-
- bmp1 = Bitmap.new(1024, 96)
- @buffers[0] = bmp1
- tobmp = @bitmaps[0]
- for i in 0..6
- draw_buffer(tobmp, i * 64, 0, bmp1, i * 32, 0)
- end
- #7のバッファ
- for i in 0..6
- draw_buffer(tobmp, i * 64, 96, bmp1, 256 + (i * 32), 0)
- end
- #15のバッファ
- for i in [0, 1, 2, 4, 5, 6]
- draw_buffer(tobmp, i * 64, 192, bmp1, 512 + (i * 32), 0)
- end
- for i in [0, 1, 2, 4, 5, 6]
- draw_buffer(tobmp, i * 64, 288, bmp1, 768 + (i * 32), 0)
- end
-
- bmp2 = Bitmap.new(1024, 96)
- @buffers[1] = bmp2
- tobmp = @bitmaps[1]
- for i in 0..7
- draw_buffer(tobmp, i * 64, 0, bmp2, i * 32, 0)
- end
- for i in 0..7
- draw_buffer(tobmp, i * 64, 96, bmp2, 256 + (i * 32), 0)
- end
- for i in 0..7
- draw_buffer(tobmp, i * 64, 192, bmp2, 512 + (i * 32), 0)
- end
- for i in 0..7
- draw_buffer(tobmp, i * 64, 288, bmp2, 768 + (i * 32), 0)
- end
- end
- #--------------------------------------------------------------------------
- def draw_buffer(bmp, ox, oy, tobmp, tox, toy)
- r = Rect.new(0, 0, 16, 16)
- #つうじょうチップ
- r.set_pos(ox + 32, oy + 64)
- tobmp.blt(tox, toy, bmp, r)
- r.set_pos(ox + 16, oy + 64)
- tobmp.blt(tox + 16, toy, bmp, r)
- r.set_pos(ox + 32, oy + 48)
- tobmp.blt(tox, toy + 16, bmp, r)
- r.set_pos(ox + 16, oy + 48)
- tobmp.blt(tox + 16, toy + 16, bmp, r)
-
- #||
- r.set_pos(ox, oy + 64)
- tobmp.blt(tox, toy + 32, bmp, r)
- r.set_pos(ox + 48, oy + 64)
- tobmp.blt(tox + 16, toy + 32, bmp, r)
- r.set_pos(ox, oy + 48)
- tobmp.blt(tox, toy + 48, bmp, r)
- r.set_pos(ox + 48, oy + 48)
- tobmp.blt(tox + 16, toy + 48, bmp, r)
-
- #=
- r.set_pos(ox + 32, oy + 32)
- tobmp.blt(tox, toy + 64, bmp, r)
- r.set_pos(ox + 16, oy + 32)
- tobmp.blt(tox + 16, toy + 64, bmp, r)
- r.set_pos(ox + 32, oy + 80)
- tobmp.blt(tox, toy + 80, bmp, r)
- r.set_pos(ox + 16, oy + 80)
- tobmp.blt(tox + 16, toy + 80, bmp, r)
- end
-
- #--------------------------------------------------------------------------
- # オートタイルの左上を描く
- # Return: 描画終了ならtrue
- #--------------------------------------------------------------------------
- def draw_lt(r, atid, ox, oy, bx)
- case
- #r.set(ox, oy, 16, 16)
- when @lt_buf_0.key?(atid)
- r.x = bx
- r.y = 0
- when @lt_buf_1.key?(atid)
- r.x = bx
- r.y = 32
- when @lt_buf_2.key?(atid)
- r.x = bx
- r.y = 64
- when @lt_1.key?(atid)
- r.x = ox + 32
- r.y = oy
- when @lt_2.key?(atid)
- r.x = ox
- r.y = oy + 32
- when @lt_3.key?(atid)
- r.x = ox + 32
- r.y = oy + 32
- when @lt_4.key?(atid)
- r.x = ox
- r.y = oy + 64
- when @lt_5.key?(atid)
- r.x = ox + 32
- r.y = oy + 64
- end
- bool = false
- case atid
- when 0, 15, 32..34, 36, 38, 40
- r.set(r.x, r.y, 32, 32)
- bool = true
- when 3, 4, 7, 8, 11, 12, 16, 18, 23, 25, 35, 37
- r.width = 32
- when 6, 9, 13, 19, 20, 28, 41
- r.height = 32
- end
- yield(@lt_buffer.key?(atid) ? @buffers : @bitmaps , r)
- return bool
- end
- #--------------------------------------------------------------------------
- # オートタイルの右上を描く
- # Return: 描画終了ならtrue
- #--------------------------------------------------------------------------
- def draw_rt(r, atid, ox, oy, bx)
- if case atid
- #r.set(ox + 16, oy, 16, 16)
- when 27
- r.set_pos(bx + 16, 32)
- when 2, 6, 10, 14, 15, 17, 19, 30, 31, 41 #2, 3, 7, 11
- r.set_pos(ox + 48, oy)
- when 1, 5, 9, 13, 28, 29, 40 #0, 1, 4, 8, 12, 16, 18
- r.set_pos(ox + 16, oy + 64)
- when 20..22, 34, 43 #35, 33, 23
- r.set_pos(ox + 16, oy + 32)
- when 24, 26, 38, 39, 44 #25, 27, 32
- r.set_pos(ox + 48, oy + 64)
- when 36, 42, 45, 46 #37
- r.set_pos(ox + 48, oy + 32)
- #when 3, 7, 11, 18, 25, 35, 37
- # false
- end then
- r.set(r.x, r.y, 16, @rt_height.key?(atid) ? 32: 16)
- yield(@rt_buffer.key?(atid) ? @buffers : @bitmaps, r)
- end
- return false
- end
- #--------------------------------------------------------------------------
- # オートタイルの左下を描く
- # Return: 描画終了ならtrue
- #--------------------------------------------------------------------------
- def draw_lb(r, atid, ox, oy, bx)
- if case atid
- #r.set(ox, oy + 16, 16, 16)
- when 1, 2, 3
- r.set_pos(bx, 16)
- when 31
- r.set_pos(bx, 80)
- when 8, 10, 11, 12, 14, 15, 22, 23, 25, 27, 37 #9, 13
- r.set_pos(ox + 32, oy + 16)
- when 4, 5, 7, 21, 24, 26, 36 #0, 1,2,3, 6, 20
- r.set_pos(ox + 32, oy + 48)
- when 16, 17, 18, 32, 34, 35, 42 #19
- r.set_pos(ox, oy + 48)
- when 29, 30, 38, 39, 45 #28, 33, 31
- r.set_pos(ox + 32, oy + 80)
- when 40, 43, 44, 46 #41
- r.set_pos(ox, oy + 80)
- #when 9, 13, 20, 28, 41
- # false
- end then
- is_buf = @lb_width.key?(atid)
- r.set(r.x, r.y, is_buf ? 32: 16, 16)
- yield(@lb_buffer.key?(atid) ? @buffers : @bitmaps, r)
- return is_buf || @rt_height.key?(atid)
- end
- return false
- end
- #--------------------------------------------------------------------------
- # オートタイルの左下を描く(バッファは使わない)
- # Return: なし
- #--------------------------------------------------------------------------
- def draw_rb(r, atid, ox, oy)
- case atid
- #r.set(ox, oy + 16, 16, 16)
- when 4, 5, 7, 13, 15, 18, 19, 21, 23, 35 #6, 12, 14
- r.set_pos(ox + 48, oy + 16)
- when 8..11, 16, 34 #0,1,2,3, 17, 20, 22
- r.set_pos(ox + 16, oy + 48)
- when 24, 25, 27, 32, 36, 37, 42 #26
- r.set_pos(ox + 48, oy + 48)
- when 30, 40, 41, 43 #28, 29, 31, 33
- r.set_pos(ox + 16, oy + 80)
- when 38, 39, 44..46
- r.set_pos(ox + 48, oy + 80)
- #when 6, 14, 20, 22, 28, 29
- #12, 17, 26
- else return
- end
- yield (@bitmaps, r)
- end
- end
复制代码
MainAutotile
存到Graphics\Pictures下bg.png
可以直接用 $game_map.mode3D = true 调用
{/hx}{/hx}翻译的工作就交给大大门了 不过貌似很容易看的懂没翻译也基本能了解了= = 日文的备注 看过去意思10有8~9能马上知道是什么= =! |
|