设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2684|回复: 1
打印 上一主题 下一主题

[已经过期] 【VX→VA】两个关于地图脚本的移植请求

[复制链接]

Lv1.梦旅人

梦石
0
星屑
75
在线时间
1074 小时
注册时间
2012-1-16
帖子
1937
跳转到指定楼层
1
发表于 2012-7-30 17:46:55 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式


好吧,表示最近在搞VA。。。打算参加短篇7。。。于是发现了两个不错的VX脚本。。。是“地图贴图”和“图块遮罩”(名字自己瞎起的,详见脚本~)。。。
于是滚过来求转换。。。因为Map方面VA修改得不大。。。所以自认为应该不难吧。。。


除此之外,还有两个帖子求关注:
http://rpg.blue/thread-243881-1-1.html
http://rpg.blue/thread-243840-1-1.html

图块遮罩:
  1. #============================================================================
  2. #
  3. # ■壁タイル拡張 □Ver.4.21 □製作者:月紳士
  4. # ・RPGツクールVX用 RGSS2スクリプト
  5. #
  6. # ●…書き換えメソッド(競合注意) ◎…メソッドのエイリアス ○…新規メソッド
  7. #
  8. # ※二次配布禁止!配布元には利用規約があります。必ずそちらを見てください。
  9. #------------------------------------------------------------------------------
  10. # ※ このスクリプトは「段差マップ 通行判定拡張」をリネームしたものです。
  11. #------------------------------------------------------------------------------
  12. # 更新履歴
  13. # Ver.4.21 FUNCTION_TILEのIDに説明との誤りがあった為、修正。
  14. # Ver.4.20 イベント側からの接触判定に段違い処理を導入。
  15. # Ver.4.13 前回の修正より、エリア系処理が機能しなくなっていた不具合の修正。
  16. # Ver.4.12 ゲームロード時に特殊通行判定が無効になっていた不具合の修正。
  17. # Ver.4.11 影消しタイルの不具合修正。
  18. # Ver.4.10 マップデータの先読み機能、処理無視エリア設定の追加。
  19. # Ver.4.00 マップ移動時の処理軽量化と様々な不具合修正。
  20. #
  21. # ※これ以前の更新履歴はマニュアルを参考にしてください。
  22. #============================================================================
  23. =begin

  24.  このスクリプトは壁タイルの、主に通行判定を拡張し、
  25.  次のような表現を可能にします。

  26.  ○ 天井や屋根を歩くことが出来るようになる。
  27.  
  28.  ○ 壁・天井・屋根タイル・橋タイルの裏(下)へキャラが回り込む

  29.  ※ 詳しい説明はマニュアルをご覧ください。

  30. =end
  31. #------------------------------------------------------------------------------


  32. #==============================================================================
  33. # □ カスタマイズ項目
  34. #==============================================================================

  35. module Expansion_Passable

  36. CLIFF_MAP = [4, 5]
  37. # 段差マップを使用するマップのID

  38. BACK_TILE_DEEP = false
  39. # 壁の深さを増すなら = true に。戻すなら = false に。

  40. BACK_SEEING = false
  41. # 裏回りした際、キャラを透過するなら = true に。しないなら = false に。

  42. SHADOW_ERASER_TILE_ID = 768
  43. # 「影消しタイル」にするタイルのIDをここで指定します。
  44. # このタイルが不要な際は = nil としてください。

  45. PROHIBITED_GET_OFF_TILE_ID = 769
  46. # 「接岸禁止」地点を示す為に使うタイルのIDをここで指定します。
  47. # このタイルが不要な際は = nil としてください。

  48. ADDITION_BACK_TILE_ID = 770
  49. # 「追加裏回り部分」を示す為に使うタイルのIDをここで指定します。
  50. # このタイルが不要な際は = nil としてください。

  51. DELETE_BACK_TILE_ID = 771
  52. # 「裏回り部分消去」を示す為に使うタイルのIDをここで指定します。
  53. # このタイルが不要な際は = nil としてください。

  54. ESCAPE_MAP = [99]
  55. # 裏回り処理自体をまったく行わないマップのID
  56. # 広いフィールドマップなどを、その読み込みを早める為に登録してください。

  57. end

  58. #==============================================================================
  59. # □ タイル情報 ※カスタマイズ可能(上級者向け)
  60. #==============================================================================

  61. module Data_Tile

  62. # 擬似段差機能を使用する屋根・天井・地形タイル
  63. FUNCTION_TILE = [
  64. 2816, 2960, # 草原(フィールド用, 屋外用)
  65. 3200, 3344, # 乾燥地帯(フィールド用, 屋外用)
  66. 3584, 3728, # 砂漠(フィールド用, 屋外用)
  67. 3968, 4112, # 雪原(フィールド用, 屋外用)
  68. 4352, 4400, 4448, 4496, 4544, 4592, 4640, 4688, # 屋根 (1列目)
  69. 4736, 4784, 4832, 4880, 4928, 4976, 5024, 5072, # 建物の壁(1列目)
  70. 5120, 5168, 5216, 5264, 5312, 5360, 5408, 5456, # 屋根 (2列目)
  71. 5504, 5552, 5600, 5648, 5696, 5744, 5792, 5840, # 建物の壁(2列目)
  72. 5888, 5936, 5984, 6032, 6080, 6128, 6176, 6224, # 洞窟の天井(1列目)
  73. 6272, 6320, 6368, 6416, 6464, 6512, 6560, 6608, # 洞窟の壁 (1列目)
  74. 6656, 6704, 6752, 6800, 6848, 6896, 6944, 6992, # 洞窟の天井(2列目)
  75. 7040, 7088, 7136, 7184, 7232, 7280, 7328, 7376, # 洞窟の壁 (2列目)
  76. 7424, 7472, 7520, 7568, 7616, 7664, 7712, 7760, # 洞窟の天井(3列目)
  77. 7808, 7856, 7904, 7952, 8000, 8048, 8096, 8144, # 洞窟の壁 (3列目)
  78. 1904, 1952, 2000] # ダミータイルID(消さないこと)
  79. # ※ 機能を使いたくないタイルがあればここから削ってください。
  80. #   (削り専用、付け加えても効果はありません)

  81. # 縦の橋としてあつかうタイルID
  82. BRIDRE_LENGTH = [17, 18, 20, 22]

  83. # 横の橋としてあつかうタイルID
  84. BRIDGE_BREADTH = [16, 19, 21, 23]

  85. # 階段・梯子・洞窟の入り口としてあつかうタイルID(ステップタイル)
  86. STEP = [67, 68, 69, 70, 71, 172, 173, 174, 175,
  87. 260, 261, 262, 263, 268, 269, 270,
  88. 271, 278, 279, 284, 285, 286, 287,
  89. 612, 613, 616, 617, 618, 619,
  90. 1600, 1601, 1602, 1603, 1604, 1605, 1606, 1607,
  91. 1608, 1609, 1610, 1611, 1612, 1613, 1614, 1615]
  92. # ※ これらのタイルが隣接している時に、境目の通行不可判定を無視させます。


  93. # 橋の下の通行判定処理用 タイルID
  94. UNDER_BRIDGE = 1664
  95. # ※ デフォルトのID_1664はゲームでは使用されない、画像のないタイルです。
  96. # 必要がなければ変更しないで結構です。

  97. end

  98. #==============================================================================
  99. # □ オートタイル情報 ※変更はしないでください。
  100. #==============================================================================

  101. module Data_Auto_Tile

  102. # 境目があるチップを方向ごとに配列化したもの↓(オートタイル内でのID)
  103. # 床タイプ
  104. VERGE_DOWN_A = [28, 29, 30, 31, 33, 38, 39, 40, 41, 43, 44, 45, 46]
  105. VERGE_LEFT_A = [16, 17, 18, 19, 32, 34, 35, 40, 41, 42, 43, 44, 46]
  106. VERGE_RIGHT_A = [24, 25, 26, 27, 32, 36, 37, 38, 39, 42, 44, 45, 46]
  107. VERGE_UP_A = [20, 21, 22, 23, 33, 34, 35, 36, 37, 42, 43, 45, 46]

  108. # 壁タイプ
  109. VERGE_DOWN_B = [8, 9, 10, 11, 12, 13, 14, 15]
  110. VERGE_LEFT_B = [1, 3, 5, 7, 9, 11, 13, 15]
  111. VERGE_RIGHT_B = [4, 5, 6, 7, 12, 13, 14, 15]
  112. VERGE_UP_B = [2, 3, 6, 7, 10, 11, 14, 15]

  113. end

  114. #==============================================================================
  115. # ■ RPG::Area
  116. #==============================================================================

  117. class RPG::Area
  118. #--------------------------------------------------------------------------
  119. # ○ 公開インスタンス変数
  120. #--------------------------------------------------------------------------
  121. attr_accessor :ship_pass
  122. attr_accessor :disregard_processing
  123. end

  124. #==============================================================================
  125. # ■ Game_Map
  126. #------------------------------------------------------------------------------
  127. #  マップを扱うクラスです。スクロールや通行可能判定などの機能を持っています。
  128. # このクラスのインスタンスは $game_map で参照されます。
  129. #==============================================================================

  130. class Game_Map
  131. #--------------------------------------------------------------------------
  132. # ○ 公開インスタンス変数
  133. #--------------------------------------------------------------------------
  134. attr_reader :map
  135. attr_reader :ex_data
  136. attr_reader :under_bridge_passages # 橋の下の通行判定
  137. attr_reader :back_tiles_position # 裏回りする座標
  138. attr_reader :keep_back_position # 裏回りを維持する座標
  139. attr_reader :prohibited_get_off # 接岸禁止座標
  140. attr_reader :ex_data # 拡張レイヤー用タイルデータ
  141. #--------------------------------------------------------------------------
  142. # ◎ セットアップ
  143. # map_id : マップ ID
  144. #--------------------------------------------------------------------------
  145. alias tig_ew_setup setup
  146. def setup(map_id)
  147. tig_ew_setup(map_id)
  148. create_ex_passages
  149. pick_up_back_tiles
  150. setup_back_tiles
  151. $game_player.set_on_tile
  152. for event in $game_map.events.values
  153. event.update_turn_back
  154. end
  155. end
  156. #--------------------------------------------------------------------------
  157. # ○ 指定座標のタイルIDの取得
  158. #--------------------------------------------------------------------------
  159. def point_tile_id(x, y)
  160. return [data[x, y, 0], data[x, y, 1], data[x, y, 2]]
  161. end
  162. #--------------------------------------------------------------------------
  163. # ○ オートタイルIDの取得(オートタイル郡の中で順番にIDをつけた独自のIDです)
  164. #--------------------------------------------------------------------------
  165. def auto_(tile_id)
  166. return 0 unless (1904...8192).include?(tile_id)
  167. return (tile_id - 1904) % 48
  168. end
  169. #--------------------------------------------------------------------------
  170. # ○ トップタイルIDの取得(オートタイル郡の最初のID)
  171. #--------------------------------------------------------------------------
  172. def top_(tile_id)
  173. return 0 if tile_id == nil
  174. return (tile_id - auto_(tile_id))
  175. end
  176. #--------------------------------------------------------------------------
  177. # ○ スクリプト機能を使用する屋根・天井・壁タイルか?
  178. #--------------------------------------------------------------------------
  179. def ceiling?(tile_id)
  180. return false unless Data_Tile::FUNCTION_TILE.include?(top_(tile_id))
  181. return true if wall?(tile_id)
  182. return true if (2000...2048).include?(tile_id)
  183. return true if (4352...4736).include?(tile_id)
  184. return true if (5120...5504).include?(tile_id)
  185. return true if (5888...6272).include?(tile_id)
  186. return true if (6656...7040).include?(tile_id)
  187. return (7424...7808).include?(tile_id)
  188. end
  189. #--------------------------------------------------------------------------
  190. # ○ スクリプト機能を使用する壁タイルか?
  191. #--------------------------------------------------------------------------
  192. def wall?(tile_id)
  193. return false unless Data_Tile::FUNCTION_TILE.include?(top_(tile_id))
  194. return true if (1904...2000).include?(tile_id)
  195. return true if (4736...5120).include?(tile_id)
  196. return true if (5504...5888).include?(tile_id)
  197. return true if (6272...6656).include?(tile_id)
  198. return true if (7040...7424).include?(tile_id)
  199. return (7808...8192).include?(tile_id)
  200. end
  201. #--------------------------------------------------------------------------
  202. # ○ スクリプト機能を使用する地形タイルか?
  203. #--------------------------------------------------------------------------
  204. def cliff?(tile_id)
  205. return false unless Data_Tile::FUNCTION_TILE.include?(top_(tile_id))
  206. return [2816, 3200, 3584, 2960, 3344, 3728, 4112].include?(top_(tile_id))
  207. end
  208. #--------------------------------------------------------------------------
  209. # ○ 指定の向きにオートタイルチップの境目があるか?
  210. #--------------------------------------------------------------------------
  211. def verge?(tile_id, direction)
  212. auto_tile_id = auto_(tile_id)

  213. return false if auto_tile_id == 0
  214. return false unless ceiling?(tile_id) or cliff?(tile_id)

  215. if (1904...2000).include?(tile_id) or
  216. (4352...5888).include?(tile_id) or
  217. (6272...6656).include?(tile_id) or
  218. (7040...7424).include?(tile_id) or
  219. (7808...8192).include?(tile_id) # オートタイルの線画タイプ判別
  220. case direction # 壁タイプの場合 方向ごとに振り分け
  221. when 2 ; return true if Data_Auto_Tile::VERGE_DOWN_B.include?(auto_tile_id)
  222. when 4 ; return true if Data_Auto_Tile::VERGE_LEFT_B.include?(auto_tile_id)
  223. when 6 ; return true if Data_Auto_Tile::VERGE_RIGHT_B.include?(auto_tile_id)
  224. when 8 ; return true if Data_Auto_Tile::VERGE_UP_B.include?(auto_tile_id)
  225. end
  226. else
  227. case direction # 床タイプの場合 方向ごとに振り分け
  228. when 2 ; return true if Data_Auto_Tile::VERGE_DOWN_A.include?(auto_tile_id)
  229. when 4 ; return true if Data_Auto_Tile::VERGE_LEFT_A.include?(auto_tile_id)
  230. when 6 ; return true if Data_Auto_Tile::VERGE_RIGHT_A.include?(auto_tile_id)
  231. when 8 ; return true if Data_Auto_Tile::VERGE_UP_A.include?(auto_tile_id)
  232. end
  233. end
  234. end
  235. #--------------------------------------------------------------------------
  236. # ○ 指定の向きに有効な境目があるか?
  237. #--------------------------------------------------------------------------
  238. def rip?(direction, x, y, floating = false)
  239. #- 位置情報の準備
  240. tile_id = point_tile_id(x, y)
  241. front_x = x_with_direction(x, direction)
  242. front_y = y_with_direction(y, direction)
  243. front_tile_id = point_tile_id(front_x, front_y)

  244. #- ステップタイルがあれば無効
  245. return false if Data_Tile::STEP.include?(front_tile_id[0])
  246. return false if Data_Tile::STEP.include?(front_tile_id[2])
  247. return false if Data_Tile::STEP.include?(tile_id[0])
  248. return false if Data_Tile::STEP.include?(tile_id[2])

  249. #- 橋タイルの処理
  250. if floating
  251. if Data_Tile::BRIDRE_LENGTH.include?(tile_id[2]) or
  252. Data_Tile::BRIDGE_BREADTH.include?(tile_id[2])
  253. return false if @under_bridge_passages[[x, y]] == -1
  254. elsif Data_Tile::BRIDRE_LENGTH.include?(front_tile_id[2]) or
  255. Data_Tile::BRIDGE_BREADTH.include?(front_tile_id[2])
  256. return false if @under_bridge_passages[[front_x, front_y]] == -1
  257. end
  258. end

  259. if bridge?(front_tile_id[2], direction)
  260. return false
  261. elsif Data_Tile::BRIDRE_LENGTH.include?(tile_id[2]) and back_tile?(x, y)
  262. return true if direction == 4 or direction == 6
  263. return false if direction == 2 or direction == 8
  264. elsif Data_Tile::BRIDGE_BREADTH.include?(tile_id[2]) and back_tile?(x, y)
  265. return true if direction == 2 or direction == 8
  266. return false if direction == 4 or direction == 6
  267. end

  268. #- 地形タイルの処理
  269. if cliff?(tile_id[0])
  270. if Expansion_Passable::CLIFF_MAP.include?($game_map.map_id)
  271. return false unless ceiling?(front_tile_id[0]) or cliff?(front_tile_id[0])
  272. if cliff?(front_tile_id[0]) and verge?(front_tile_id[0], 10 - direction)
  273. return false
  274. end
  275. else
  276. return false
  277. end
  278. end

  279. #- タイルに境目があるか?
  280. return verge?(tile_id[0], direction)
  281. end
  282. #--------------------------------------------------------------------------
  283. # ○ 指定の向きに準じた橋タイルか?(渡ることの出来る向きか)
  284. #--------------------------------------------------------------------------
  285. def bridge?(tile_id, direction)
  286. if direction == 2 or direction == 8
  287. return true if Data_Tile::BRIDRE_LENGTH.include?(tile_id)
  288. elsif direction == 4 or direction == 6
  289. return true if Data_Tile::BRIDGE_BREADTH.include?(tile_id)
  290. end
  291. return false
  292. end
  293. #--------------------------------------------------------------------------
  294. # ○ 上層に移すタイルか?
  295. #--------------------------------------------------------------------------
  296. def upper_layer?(tile_id)
  297. return false if @back_tiles_a == nil
  298. if Expansion_Passable::CLIFF_MAP.include?(@map_id)
  299. return true if @back_tiles_b.include?(tile_id)
  300. else
  301. unless cliff?(tile_id)
  302. return true if @back_tiles_a.include?(tile_id)
  303. end
  304. end
  305. end
  306. #--------------------------------------------------------------------------
  307. # ○ <船の橋下通過>処理をするエリアか?
  308. #--------------------------------------------------------------------------
  309. def ship_pass_area?(x, y)
  310. result = false
  311. for area in $data_areas.values
  312. next if area == nil
  313. next unless area.ship_pass
  314. next if $game_map.map_id != area.map_id
  315. next if x < area.rect.x
  316. next if y < area.rect.y
  317. next if x >= area.rect.x + area.rect.width
  318. next if y >= area.rect.y + area.rect.height
  319. result = true
  320. end
  321. return result
  322. end
  323. #--------------------------------------------------------------------------
  324. # ○ 処理の無視をするエリアか?
  325. #--------------------------------------------------------------------------
  326. def disregard_processing_area?(x, y, map_id)
  327. result = false
  328. for area in $data_areas.values
  329. next if area == nil
  330. next unless area.disregard_processing
  331. next if map_id != area.map_id
  332. next if x < area.rect.x
  333. next if y < area.rect.y
  334. next if x >= area.rect.x + area.rect.width
  335. next if y >= area.rect.y + area.rect.height
  336. result = true
  337. end
  338. return result
  339. end
  340. #--------------------------------------------------------------------------
  341. # ○ 段差マップか?
  342. #--------------------------------------------------------------------------
  343. def cliff_map?
  344. return Expansion_Passable::CLIFF_MAP.include?(@map_id)
  345. end
  346. #--------------------------------------------------------------------------
  347. # ○ 特殊通行判定の作成
  348. #--------------------------------------------------------------------------
  349. def create_ex_passages
  350. @ex_passages = $data_system.passages

  351. #- 壁・屋根・天井タイルの通行判定を○に変える
  352. for i in 1904...2048
  353. @ex_passages[i] = 0x06 if ceiling?(i)
  354. end
  355. for i in 4352...8192
  356. @ex_passages[i] = 0x06 if ceiling?(i)
  357. end

  358. #- 橋タイルの通行判定を○に
  359. for i in (Data_Tile::BRIDRE_LENGTH + Data_Tile::BRIDGE_BREADTH)
  360. @ex_passages[i] = 0x00
  361. end

  362. @passages = @ex_passages
  363. end
  364. #--------------------------------------------------------------------------
  365. # ○ 接岸禁止タイル登録
  366. # map_id : マップ ID
  367. #--------------------------------------------------------------------------
  368. def prohibited_get_off_set(x, y)
  369. @map.data[x, y, 2] = 0
  370. @prohibited_get_off.push([x, y])
  371. end
  372. #--------------------------------------------------------------------------
  373. # ○ 影消しタイル処理
  374. #--------------------------------------------------------------------------
  375. def shadow_eraser(x, y)
  376. r_x = round_x(x - 1) ; r_y = round_y(y - 1)
  377. tile_id = @map.data[r_x, y, 0]

  378. # 壁(線画・壁タイプ)
  379. if (4736...5120).include?(tile_id) or
  380. (5504...5888).include?(tile_id) or
  381. (6272...6656).include?(tile_id) or
  382. (7040...7424).include?(tile_id) or
  383. (7808...8192).include?(tile_id)
  384. dummy_tile_id = 1904 + auto_(tile_id)
  385. # 屋根(線画・壁タイプ)
  386. elsif (4352...4736).include?(tile_id) or
  387. (5120...5504).include?(tile_id)
  388. dummy_tile_id = 1952 + auto_(tile_id)
  389. # 天井(線画・床タイプ)
  390. elsif (5888...6272).include?(tile_id) or
  391. (6656...7040).include?(tile_id) or
  392. (7424...7808).include?(tile_id)
  393. dummy_tile_id = 2000 + auto_(tile_id)
  394. else
  395. return
  396. end

  397. @map.data[r_x, r_y, 1] = @map.data[r_x, r_y, 0]
  398. @map.data[r_x, r_y, 0] = dummy_tile_id
  399. end
  400. #--------------------------------------------------------------------------
  401. # ○ 裏回り消去タイル処理
  402. #--------------------------------------------------------------------------
  403. def back_tiles_position_delete(x, y)
  404. return if Expansion_Passable::DELETE_BACK_TILE_ID == nil
  405. y = round_y(y+1) if Expansion_Passable::BACK_TILE_DEEP
  406. if @map.data[x, y, 2] == Expansion_Passable::DELETE_BACK_TILE_ID or
  407. @ex_data[x, y, 2] == Expansion_Passable::DELETE_BACK_TILE_ID
  408. @back_tiles_position.delete([x, y])
  409. @map.data[x, y, 2] = 0
  410. @ex_data[x, y, 2] = 0
  411. end
  412. end
  413. #--------------------------------------------------------------------------
  414. # ○ 裏回り用タイル種類ピックアップ
  415. #--------------------------------------------------------------------------
  416. def pick_up_back_tiles
  417. return if @back_tiles_a != nil

  418. @back_tiles_a = []
  419. @back_tiles_b = []
  420. for i in 1904...8192
  421. next unless ceiling?(i) or cliff?(i)
  422. if wall?(i)
  423. next if verge?(i, 2)
  424. if verge?(i, 4) or verge?(i, 6)
  425. @back_tiles_a.push(i) unless cliff?(i)
  426. end
  427. else
  428. @back_tiles_a.push(i) unless cliff?(i)
  429. @back_tiles_b.push(i) if verge?(i, 8)
  430. end
  431. end
  432. end
  433. #--------------------------------------------------------------------------
  434. # ○ 通行判定初期化と裏回り用タイル座標ピックアップ
  435. #--------------------------------------------------------------------------
  436. def setup_back_tiles
  437. if $game_player.game_map_data.include?(@map_id)
  438. @map = $game_player.game_map_data[@map_id].map
  439. @ex_data = $game_player.game_map_data[@map_id].ex_data
  440. @under_bridge_passages = $game_player.game_map_data[@map_id].under_bridge_passages
  441. @back_tiles_position = $game_player.game_map_data[@map_id].back_tiles_position
  442. @keep_back_position = $game_player.game_map_data[@map_id].keep_back_position
  443. @prohibited_get_off = $game_player.game_map_data[@map_id].prohibited_get_off
  444. return
  445. end

  446. @ex_data = Table.new(width, height, 3)
  447. @under_bridge_passages = {}
  448. @back_tiles_position = []
  449. @keep_back_position = []
  450. @prohibited_get_off = []

  451. return if Expansion_Passable::ESCAPE_MAP.include?(@map_id)

  452. #- 座標毎処理
  453. for x in 0...width
  454. for reverse_y in 1..height
  455. y = height - reverse_y # Y座標を逆順にする為の処理
  456. next if disregard_processing_area?(x, y, @map_id)

  457. tile_id = point_tile_id(x, y)

  458. #- 橋タイル処理
  459. if (Data_Tile::BRIDRE_LENGTH + Data_Tile::BRIDGE_BREADTH).include?(tile_id[2])
  460. if (2048...2815).include?(tile_id[0])
  461. if ship_pass_area?(x, y)
  462. @under_bridge_passages[[x, y]] = 1
  463. @back_tiles_position.push([x, y])
  464. @ex_data[x, y, 2] = @map.data[x, y, 2]
  465. else
  466. @back_tiles_position.push([x, y])
  467. @under_bridge_passages[[x, y]] = -1
  468. end
  469. elsif @passages[tile_id[0]] != 0x06 or $game_map.wall?(tile_id[0])
  470. @under_bridge_passages[[x, y]] = -1
  471. @back_tiles_position.push([x, y])
  472. @ex_data[x, y, 2] = @map.data[x, y, 2]
  473. else
  474. @under_bridge_passages[[x, y]] = 0
  475. @back_tiles_position.push([x, y])
  476. @ex_data[x, y, 2] = @map.data[x, y, 2]
  477. end
  478. if Data_Tile::BRIDGE_BREADTH.include?(tile_id[2])
  479. @keep_back_position.push([x, round_y(y+1)])
  480. end

  481. #- 通行判定☆タイルを上層に移動
  482. elsif tile_id[2] != 0 and @passages[tile_id[2]] & 0x10 == 0x10
  483. if @back_tiles_position.include?([x, round_y(y+1)])
  484. @keep_back_position.push([x, y])
  485. else
  486. @ex_data[x, y, 2] = @map.data[x, y, 2]
  487. end
  488. end

  489. #- 影消しタイルの処理
  490. if @map.data[x, y, 2] == Expansion_Passable::SHADOW_ERASER_TILE_ID
  491. shadow_eraser(x, y)
  492. @map.data[x, y, 2] = 0
  493. #- 接岸禁止タイルの処理
  494. elsif @map.data[x, y, 2] == Expansion_Passable::PROHIBITED_GET_OFF_TILE_ID
  495. prohibited_get_off_set(x, y)
  496. end

  497. #- 壁・天井タイル処理
  498. if ceiling?(tile_id[0]) or (cliff?(tile_id[0]) and cliff_map?)

  499. #- 基本となる裏回りタイルの場合、裏回り位置に登録
  500. if not wall?(tile_id[0]) and verge?(tile_id[0], 8)
  501. @back_tiles_position.push([x, y])
  502. end

  503. #- 裏回り位置にするタイルの場合、上層に移動
  504. back_tiles = cliff_map? ? @back_tiles_b : @back_tiles_a
  505. if back_tiles.include?(tile_id[0])
  506. @ex_data[x, y, 0] = @map.data[x, y, 0]
  507. @ex_data[x, y, 1] = @map.data[x, y, 1]
  508. #- 裏回り位置追加タイルの誤用時には、タイルを消去する
  509. if tile_id[2] != Expansion_Passable::ADDITION_BACK_TILE_ID
  510. @ex_data[x, y, 2] = @map.data[x, y, 2]
  511. end
  512. @map.data[x, y, 1] = 0
  513. @map.data[x, y, 2] = 0
  514. end

  515. #- 深く裏回りする設定の際の処理(裏回り位置の下をさらに上層に)
  516. if Expansion_Passable::BACK_TILE_DEEP
  517. unless @back_tiles_position.include?([x, round_y(y+1)])
  518. if not wall?(tile_id[0]) and verge?(tile_id[0], 8)
  519. unless wall?(data[x, round_y(y+1), 0]) and verge?(data[x, round_y(y+1), 0], 2)
  520. @back_tiles_position.push([x, round_y(y+1)])
  521. @ex_data[x, round_y(y+1), 0] = @map.data[x, round_y(y+1), 0]
  522. @ex_data[x, round_y(y+1), 1] = @map.data[x, round_y(y+1), 1]
  523. @ex_data[x, round_y(y+1), 2] = @map.data[x, round_y(y+1), 2]
  524. @map.data[x, round_y(y+1), 1] = 0
  525. @map.data[x, round_y(y+1), 2] = 0
  526. end
  527. end
  528. end
  529. end

  530. #- 裏回り追加タイルの処理
  531. if Expansion_Passable::ADDITION_BACK_TILE_ID != nil and
  532. tile_id[2] == Expansion_Passable::ADDITION_BACK_TILE_ID
  533. @back_tiles_position.push([x, y])
  534. @ex_data[x, y, 0] = @map.data[x, y, 0]
  535. @ex_data[x, y, 1] = @map.data[x, y, 1]
  536. @map.data[x, y, 2] = 0
  537. if (2816...8192).include?(@map.data[x, round_y(y-1), 0])
  538. @ex_data[x, round_y(y-1), 0] = @map.data[x, round_y(y-1), 0]
  539. @ex_data[x, round_y(y-1), 1] = @map.data[x, round_y(y-1), 1]
  540. end
  541. end
  542. end

  543. #- 裏回り部分除去タイルの処理
  544. back_tiles_position_delete(x, y)
  545. end
  546. end
  547. end
  548. #--------------------------------------------------------------------------
  549. # ○ 裏回り用タイルの存在する座標か?
  550. #--------------------------------------------------------------------------
  551. def back_tile?(x, y)
  552. return false if @back_tiles_position == nil
  553. return @back_tiles_position.include?([x, y])
  554. end
  555. end

  556. #==============================================================================
  557. # ■ Game_Character
  558. #------------------------------------------------------------------------------
  559. #  キャラクターを扱うクラスです。このクラスは Game_Player クラスと Game_Event
  560. # クラスのスーパークラスとして使用されます。
  561. #==============================================================================

  562. class Game_Character
  563. #--------------------------------------------------------------------------
  564. # ○ 公開インスタンス変数
  565. #--------------------------------------------------------------------------
  566. attr_reader :on_tile
  567. attr_reader :turn_back
  568. attr_accessor :no_turn_back
  569. attr_reader :back_seeing
  570. attr_reader :not_back_seeing
  571. #--------------------------------------------------------------------------
  572. # ◎ オブジェクト初期化
  573. #--------------------------------------------------------------------------
  574. alias tig_ew_initialize initialize
  575. def initialize
  576. tig_ew_initialize
  577. @vehicle_type = -1
  578. @turn_back = false
  579. @no_turn_back = false
  580. @on_tile = true
  581. @back_seeing = false
  582. @not_back_seeing = false
  583. end
  584. #--------------------------------------------------------------------------
  585. # ◎ フレーム更新
  586. #--------------------------------------------------------------------------
  587. alias tig_ew_update update
  588. def update
  589. if @first_update == nil
  590. update_turn_back
  591. @first_update = true
  592. end
  593. tig_ew_update
  594. end
  595. #--------------------------------------------------------------------------
  596. # ◎ 指定位置に移動
  597. # x : X 座標
  598. # y : Y 座標
  599. #--------------------------------------------------------------------------
  600. alias tig_ew_moveto moveto
  601. def moveto(x, y)
  602. tig_ew_moveto(x, y)
  603. update_turn_back
  604. end
  605. #--------------------------------------------------------------------------
  606. # ◎ ジャンプ時の更新
  607. #--------------------------------------------------------------------------
  608. alias tig_ew_update_jump update_jump
  609. def update_jump
  610. tig_ew_update_jump
  611. update_turn_back
  612. end
  613. #--------------------------------------------------------------------------
  614. # ◎ 移動時の更新
  615. #--------------------------------------------------------------------------
  616. alias tig_ew_update_move update_move
  617. def update_move
  618. tig_ew_update_move
  619. update_turn_back unless moving?
  620. end
  621. #--------------------------------------------------------------------------
  622. # ◎ 歩数増加
  623. #--------------------------------------------------------------------------
  624. alias tig_ew_increase_steps increase_steps
  625. def increase_steps
  626. tig_ew_increase_steps
  627. update_turn_back
  628. end
  629. #--------------------------------------------------------------------------
  630. # ○ 2座標の位置関係を向きで取得
  631. #--------------------------------------------------------------------------
  632. def search_direction(start_x, start_y, arriv_x, arriv_y)
  633. if start_x == arriv_x
  634. if start_y == arriv_y
  635. return 5
  636. elsif start_y < arriv_y
  637. return 2
  638. elsif start_y > arriv_y
  639. return 8
  640. end
  641. elsif start_x < arriv_x
  642. if start_y == arriv_y
  643. return 6
  644. elsif start_y < arriv_y
  645. return 3
  646. elsif start_y > arriv_y
  647. return 9
  648. end
  649. elsif start_x > arriv_x
  650. if start_y == arriv_y
  651. return 4
  652. elsif start_y < arriv_y
  653. return 1
  654. elsif start_y > arriv_y
  655. return 7
  656. end
  657. end
  658. end
  659. #--------------------------------------------------------------------------
  660. # ○ 裏回りセット
  661. #--------------------------------------------------------------------------
  662. def set_turn_back
  663. @turn_back = true
  664. @on_tile = false
  665. end
  666. #--------------------------------------------------------------------------
  667. # ○ 天井載せセット
  668. #--------------------------------------------------------------------------
  669. def set_on_tile
  670. @turn_back = false
  671. @on_tile = true
  672. end
  673. #--------------------------------------------------------------------------
  674. # ○ 裏回り状態更新
  675. #--------------------------------------------------------------------------
  676. def update_turn_back
  677. tile_id = $game_map.point_tile_id(@x, @y)
  678. direction = search_direction(@real_x, @real_y, @x * 256, @y * 256)
  679. if self.is_a?(Game_Player) and [2, 4].include?(@vehicle_type)
  680. @turn_back = false
  681. @no_turn_back = false
  682. @on_tile = true
  683. return
  684. end
  685. #- 段差マップの場合
  686. if Expansion_Passable::CLIFF_MAP.include?($game_map.map_id)
  687. #- 停止時の更新
  688. if direction == 5
  689. @turn_back = false if @no_turn_back
  690. unless $game_map.back_tile?(@x, @y)
  691. @turn_back = false
  692. @no_turn_back = false
  693. end
  694. @on_tile = true unless @turn_back
  695. #- 移動開始時の更新
  696. else
  697. if direction % 2 == 0
  698. if $game_map.rip?(10 - direction, @x, @y, floating?)
  699. @turn_back = true unless @no_turn_back
  700. end
  701. else
  702. if diagonal_move_turn_back(direction, @x, @y)
  703. @turn_back = true unless @no_turn_back
  704. end
  705. end
  706. @on_tile = false if @turn_back
  707. end
  708. if not @turn_back or @no_turn_back
  709. if $game_map.keep_back_position != nil and $game_map.keep_back_position.include?([@x, @y])
  710. @on_tile = false
  711. return
  712. end
  713. end
  714. #- 通常マップの場合
  715. else
  716. #- 停止時の更新
  717. if direction == 5
  718. unless $game_map.back_tile?(@x, @y)
  719. @turn_back = false
  720. @no_turn_back = false
  721. end
  722. if $game_map.upper_layer?(tile_id[0])
  723. @on_tile = true
  724. else
  725. @on_tile = false
  726. end
  727. #- 移動開始時の更新
  728. else
  729. if direction % 2 == 0
  730. if $game_map.rip?(10 - direction, @x, @y, floating?)
  731. @turn_back = true unless @no_turn_back
  732. end
  733. else
  734. if diagonal_move_turn_back(direction, @x, @y)
  735. @turn_back = true unless @no_turn_back
  736. end
  737. end
  738. end
  739. if $game_map.back_tile?(@x, @y)
  740. if @turn_back
  741. @on_tile = false
  742. else
  743. @on_tile = true
  744. end
  745. elsif Data_Tile::STEP.include?(tile_id[0]) or Data_Tile::STEP.include?(tile_id[2])
  746. @on_tile = true
  747. end
  748. end
  749. end
  750. #--------------------------------------------------------------------------
  751. # ○ 斜め移動時の裏回り状態判別
  752. #--------------------------------------------------------------------------
  753. def diagonal_move_turn_back(direction, x, y)
  754. turn_back = false
  755. case direction
  756. when 1
  757. turn_back = true if $game_map.rip?(8, x+1, y, floating?)
  758. turn_back = true if $game_map.rip?(6, x, y, floating?)
  759. turn_back = true if $game_map.rip?(6, x, y-1, floating?)
  760. turn_back = true if $game_map.rip?(8, x, y, floating?)
  761. when 3
  762. turn_back = true if $game_map.rip?(8, x-1, y, floating?)
  763. turn_back = true if $game_map.rip?(4, x, y, floating?)
  764. turn_back = true if $game_map.rip?(4, x, y-1, floating?)
  765. turn_back = true if $game_map.rip?(8, x, y, floating?)
  766. when 7
  767. turn_back = true if $game_map.rip?(6, x, y+1, floating?)
  768. turn_back = true if $game_map.rip?(2, x, y, floating?)
  769. turn_back = true if $game_map.rip?(2, x+1, y, floating?)
  770. turn_back = true if $game_map.rip?(6, x, y, floating?)
  771. when 9
  772. turn_back = true if $game_map.rip?(4, x, y+1, floating?)
  773. turn_back = true if $game_map.rip?(2, x, y, floating?)
  774. turn_back = true if $game_map.rip?(2, x-1, y, floating?)
  775. turn_back = true if $game_map.rip?(4, x, y, floating?)
  776. end
  777. return turn_back
  778. end
  779. #--------------------------------------------------------------------------
  780. # ○ この場が裏か判定
  781. #--------------------------------------------------------------------------
  782. def back_tile?(pos)
  783. return $game_map.back_tile?(pos[0], pos[1])
  784. end
  785. #--------------------------------------------------------------------------
  786. # ○ 橋の下の通行判定
  787. #--------------------------------------------------------------------------
  788. def under_bridge_passages(pos)
  789. return true unless $game_map.under_bridge_passages.key?(pos)
  790. case @vehicle_type
  791. when -1
  792. return $game_map.under_bridge_passages[pos] == 0
  793. when 0..1
  794. return $game_map.under_bridge_passages[pos] > 0
  795. when 5
  796. return $game_map.under_bridge_passages[pos] >= 0
  797. else
  798. return false
  799. end
  800. end
  801. #--------------------------------------------------------------------------
  802. # ○ 浮かんでいるか?(乗り物拡張用・魔法の絨毯搭乗時)
  803. #--------------------------------------------------------------------------
  804. def floating?
  805. return false
  806. end
  807. #--------------------------------------------------------------------------
  808. # ○ 壁タイル拡張通行判定
  809. #--------------------------------------------------------------------------
  810. # x , y を省略すると…
  811. # プレイヤーの現在位置(始点)からdirection方向へ通過出来るかどうかを判定。
  812. # x , y を代入すると…
  813. # その座標(終点)へdirection方向から進入できるかどうかを判定。
  814. #--------------------------------------------------------------------------
  815. def ex_passable(direction, x = nil, y = nil, turn_back = nil)
  816. return true if debug_through? # デバッグ動作中なら通行可
  817. return true if @through # すり抜け中なら通行可

  818. #- 位置情報の準備
  819. if x == nil
  820. start_pos = [@x, @y]
  821. arriv_pos = [$game_map.x_with_direction(@x, direction), $game_map.y_with_direction(@y, direction)]
  822. else
  823. start_pos = [$game_map.x_with_direction(x, 10 - direction), $game_map.y_with_direction(y, 10 - direction)]
  824. arriv_pos = [x, y]
  825. end
  826. start_tile = $game_map.point_tile_id(start_pos[0], start_pos[1])
  827. arriv_tile = $game_map.point_tile_id(arriv_pos[0], arriv_pos[1])
  828. start_side_rip = $game_map.rip?(direction, start_pos[0], start_pos[1], floating?)
  829. arriv_side_rip = $game_map.rip?(10 - direction, arriv_pos[0], arriv_pos[1], floating?)

  830. turn_back = @turn_back if turn_back == nil

  831. #- 階段タイルなら通行可
  832. unless back_tile?(start_pos) and turn_back
  833. return true if Data_Tile::STEP.include?(arriv_tile[0])
  834. return true if Data_Tile::STEP.include?(arriv_tile[2])
  835. unless $game_map.wall?(arriv_tile[0])
  836. return true if Data_Tile::STEP.include?(start_tile[0])
  837. return true if Data_Tile::STEP.include?(start_tile[2])
  838. end
  839. end

  840. #- 境目&橋の下の通行判定
  841. if back_tile?(start_pos) and turn_back # 始点が裏かつ裏回り中
  842. return false unless under_bridge_passages(arriv_pos) # 橋の下の通行判定
  843. unless back_tile?(arriv_pos) # 終点が裏でない
  844. if start_side_rip # 始点側に境目がある
  845. if arriv_side_rip # 終点側に境目がある
  846. return false
  847. else
  848. return false if $game_map.wall?(arriv_tile[0])
  849. end
  850. else # 始点側に境目がない
  851. return false
  852. end
  853. end
  854. else # 始点は裏でない
  855. unless $game_map.bridge?(arriv_tile[2], direction) or # 橋がなければ
  856. $game_map.bridge?(start_tile[2], direction)
  857. if start_side_rip # 始点側に境目がある
  858. return false
  859. else # 始点側に境目がない
  860. if arriv_side_rip # 終点側に境目がある
  861. if back_tile?(arriv_pos) # 終点が裏
  862. unless $game_map.bridge?(start_tile[2], direction) # この場が橋でなければ
  863. return false unless under_bridge_passages(arriv_pos) # 橋の下の通行判定
  864. turn_back = true
  865. end
  866. else # 終点が裏でない
  867. unless $game_map.bridge?(start_tile[2], direction) # この場が橋でなければ
  868. return false
  869. end
  870. end
  871. else # 終点側に境目がない
  872. return false if $game_map.wall?(arriv_tile[0])
  873. end
  874. end
  875. end
  876. end

  877. #- 上層の通行判定
  878. if $game_map.upper_layer?(arriv_tile[0]) and not turn_back
  879. for i in [2, 1, 0] # レイヤーの上から順に調べる
  880. tile_id = $game_map.ex_data[arriv_pos[0], arriv_pos[1], i] # タイル ID を取得
  881. unless tile_id == nil
  882. pass = $game_map.passages[tile_id] # 通行属性を取得
  883. next if pass & 0x10 == 0x10 # [☆] : 通行に影響しない
  884. next if pass & 0x01 == 0x00 # [○] : 通行可
  885. if pass & 0x01 == 0x01 # [×] : 通行不可
  886. return false
  887. end
  888. end
  889. end
  890. end

  891. return true
  892. end
  893. #--------------------------------------------------------------------------
  894. # ◎ 下に移動
  895. # turn_ok : その場での向き変更を許可
  896. #--------------------------------------------------------------------------
  897. alias tig_ew_move_down move_down
  898. def move_down(turn_ok = true)
  899. unless ex_passable(2)
  900. turn_down if turn_ok
  901. @move_failed = true
  902. check_event_trigger_touch(@x, @y+1) # 接触イベントの起動判定
  903. return
  904. end
  905. tig_ew_move_down(turn_ok)
  906. end
  907. #--------------------------------------------------------------------------
  908. # ◎ 左に移動
  909. # turn_ok : その場での向き変更を許可
  910. #--------------------------------------------------------------------------
  911. alias tig_ew_move_left move_left
  912. def move_left(turn_ok = true)
  913. unless ex_passable(4)
  914. turn_left if turn_ok
  915. @move_failed = true
  916. check_event_trigger_touch(@x-1, @y) # 接触イベントの起動判定
  917. return
  918. end
  919. tig_ew_move_left(turn_ok)
  920. end
  921. #--------------------------------------------------------------------------
  922. # ◎ 右に移動
  923. # turn_ok : その場での向き変更を許可
  924. #--------------------------------------------------------------------------
  925. alias tig_ew_move_right move_right
  926. def move_right(turn_ok = true)
  927. unless ex_passable(6)
  928. turn_right if turn_ok
  929. check_event_trigger_touch(@x+1, @y) # 接触イベントの起動判定
  930. @move_failed = true
  931. return
  932. end
  933. tig_ew_move_right(turn_ok)
  934. end
  935. #--------------------------------------------------------------------------
  936. # ◎ 上に移動
  937. # turn_ok : その場での向き変更を許可
  938. #--------------------------------------------------------------------------
  939. alias tig_ew_move_up move_up
  940. def move_up(turn_ok = true)
  941. unless ex_passable(8)
  942. turn_up if turn_ok
  943. check_event_trigger_touch(@x, @y-1) # 接触イベントの起動判定
  944. @move_failed = true
  945. return
  946. end
  947. tig_ew_move_up(turn_ok)
  948. end
  949. #--------------------------------------------------------------------------
  950. # ◎ 左下に移動
  951. #--------------------------------------------------------------------------
  952. alias tig_ew_move_lower_left move_lower_left
  953. def move_lower_left
  954. turn_back1 = $game_map.rip?(8, @x, @y+1) ? true : @turn_back
  955. turn_back2 = $game_map.rip?(6, @x-1, @y) ? true : @turn_back
  956. unless passable?(@x, @y+1) and passable?(@x-1, @y) and passable?(@x-1, @y+1) and
  957. ex_passable(2) and ex_passable(4, @x-1, @y+1, turn_back1) and
  958. ex_passable(4) and ex_passable(2, @x-1, @y+1, turn_back2)
  959. if @direction == 2
  960. if passable?(@x-1, @y) and ex_passable(4)
  961. move_left
  962. else
  963. move_down
  964. end
  965. elsif @direction == 4
  966. if passable?(@x, @y+1) and ex_passable(2)
  967. move_down
  968. else
  969. move_left
  970. end
  971. end
  972. return
  973. end
  974. tig_ew_move_lower_left
  975. end
  976. #--------------------------------------------------------------------------
  977. # ◎ 右下に移動
  978. #--------------------------------------------------------------------------
  979. alias tig_ew_move_lower_right move_lower_right
  980. def move_lower_right
  981. turn_back1 = $game_map.rip?(8, @x, @y+1) ? true : @turn_back
  982. turn_back2 = $game_map.rip?(4, @x+1, @y) ? true : @turn_back
  983. unless passable?(@x, @y+1) and passable?(@x+1, @y) and passable?(@x+1, @y+1) and
  984. ex_passable(2) and ex_passable(6, @x+1, @y+1, turn_back1) and
  985. ex_passable(6) and ex_passable(2, @x+1, @y+1, turn_back2)
  986. if @direction == 2
  987. if passable?(@x-1, @y) and ex_passable(6)
  988. move_right
  989. else
  990. move_down
  991. end
  992. elsif @direction == 6
  993. if passable?(@x, @y+1) and ex_passable(2)
  994. move_down
  995. else
  996. move_right
  997. end
  998. end
  999. return
  1000. end
  1001. tig_ew_move_lower_right
  1002. end
  1003. #--------------------------------------------------------------------------
  1004. # ◎ 左上に移動
  1005. #--------------------------------------------------------------------------
  1006. alias tig_ew_move_upper_left move_upper_left
  1007. def move_upper_left
  1008. turn_back1 = $game_map.rip?(2, @x, @y-1) ? true : @turn_back
  1009. turn_back2 = $game_map.rip?(6, @x-1, @y) ? true : @turn_back
  1010. unless passable?(@x, @y-1) and passable?(@x-1, @y) and passable?(@x-1, @y-1) and
  1011. ex_passable(8) and ex_passable(4, @x-1, @y-1, turn_back1) and
  1012. ex_passable(4) and ex_passable(8, @x-1, @y-1, turn_back2)
  1013. if @direction == 8
  1014. if passable?(@x-1, @y) and ex_passable(4)
  1015. move_left
  1016. else
  1017. move_up
  1018. end
  1019. elsif @direction == 4
  1020. if passable?(@x, @y+1) and ex_passable(8)
  1021. move_up
  1022. else
  1023. move_left
  1024. end
  1025. end
  1026. return
  1027. end
  1028. tig_ew_move_upper_left
  1029. end
  1030. #--------------------------------------------------------------------------
  1031. # ◎ 右上に移動
  1032. #--------------------------------------------------------------------------
  1033. alias tig_ew_move_upper_right move_upper_right
  1034. def move_upper_right
  1035. turn_back1 = $game_map.rip?(2, @x, @y-1) ? true : @turn_back
  1036. turn_back2 = $game_map.rip?(4, @x+1, @y) ? true : @turn_back
  1037. unless passable?(@x, @y-1) and passable?(@x+1, @y) and passable?(@x+1, @y-1) and
  1038. ex_passable(8) and ex_passable(6, @x+1, @y-1, turn_back1) and
  1039. ex_passable(6) and ex_passable(8, @x+1, @y-1, turn_back2)
  1040. if @direction == 8
  1041. if passable?(@x+1, @y) and ex_passable(6)
  1042. move_right
  1043. else
  1044. move_up
  1045. end
  1046. elsif @direction == 6
  1047. if passable?(@x, @y-1) and ex_passable(8)
  1048. move_up
  1049. else
  1050. move_right
  1051. end
  1052. end
  1053. return
  1054. end
  1055. tig_ew_move_upper_right
  1056. end
  1057. #--------------------------------------------------------------------------
  1058. # ● キャラクター衝突判定
  1059. # x : X 座標
  1060. # y : Y 座標
  1061. # プレイヤーと乗り物を含め、通常キャラの衝突を検出する。
  1062. #--------------------------------------------------------------------------
  1063. def collide_with_characters?(x, y)
  1064. for event in $game_map.events_xy(x, y) # イベントの座標と一致
  1065. next unless parallel?(event) ##### 追加部分 (この行) #####
  1066. unless event.through # すり抜け OFF?
  1067. return true if self.is_a?(Game_Event) # 自分がイベント
  1068. return true if event.priority_type == 1 # 相手が通常キャラ
  1069. end
  1070. end
  1071. if @priority_type == 1 # 自分が通常キャラ
  1072. if parallel?($game_player) ##### 追加部分 (この行) #####
  1073. return true if $game_player.pos_nt?(x, y) # プレイヤーの座標と一致
  1074. end ##### 追加部分 (この行) #####
  1075. return true if $game_map.boat.pos_nt?(x, y) # 小型船の座標と一致
  1076. return true if $game_map.ship.pos_nt?(x, y) # 大型船の座標と一致
  1077. end
  1078. return false
  1079. end
  1080. #--------------------------------------------------------------------------
  1081. # ○ キャラクターの同軸存在判定
  1082. #--------------------------------------------------------------------------
  1083. def parallel?(character)
  1084. direction = search_direction(@x, @y, character.x, character.y)
  1085. turn_back = @turn_back
  1086. character_turn_back = character.turn_back
  1087. if direction != 5
  1088. if direction % 2 == 0
  1089. if $game_map.rip?(10 - direction, character.x, character.y)
  1090. turn_back = true
  1091. end
  1092. else
  1093. if diagonal_move_turn_back(direction, character.x, character.y)
  1094. turn_back = true
  1095. end
  1096. end
  1097. if direction % 2 == 0
  1098. if $game_map.rip?(direction, @x, @y)
  1099. character_turn_back = true
  1100. end
  1101. else
  1102. if diagonal_move_turn_back(10 - direction, @x, @y)
  1103. character_turn_back = true
  1104. end
  1105. end
  1106. tile_id = $game_map.data[character.x, character.y, 0]
  1107. if $game_map.wall?(tile_id)
  1108. return true unless ex_passable(direction)
  1109. end
  1110. end

  1111. return turn_back == character_turn_back
  1112. end
  1113. end

  1114. #==============================================================================
  1115. # ■ Game_Event
  1116. #------------------------------------------------------------------------------
  1117. #  イベントを扱うクラスです。条件判定によるイベントページ切り替えや、並列処理
  1118. # イベント実行などの機能を持っており、Game_Map クラスの内部で使用されます。
  1119. #==============================================================================

  1120. class Game_Event < Game_Character
  1121. #--------------------------------------------------------------------------
  1122. # ◎ オブジェクト初期化
  1123. # map_id : マップ ID
  1124. # event : イベント (RPG::Event)
  1125. #--------------------------------------------------------------------------
  1126. alias tig_ew_event_initialize initialize
  1127. def initialize(map_id, event)
  1128. tig_ew_event_initialize(map_id, event)
  1129. set_turn_back_setting
  1130. end
  1131. #--------------------------------------------------------------------------
  1132. # ○ イベントの初期配置位置取得(裏配置)
  1133. #--------------------------------------------------------------------------
  1134. def set_turn_back_setting
  1135. @event.name = @event.name.sub(/[\<<]裏配置[\>>]/, "")
  1136. @turn_back = $& != nil
  1137. @on_tile = $& == nil
  1138. @event.name = @event.name.sub(/[\<<]裏透過禁止[\>>]/, "")
  1139. @not_back_seeing = $& != nil
  1140. end
  1141. #--------------------------------------------------------------------------
  1142. # ● 接触イベントの起動判定
  1143. #--------------------------------------------------------------------------
  1144. def check_event_trigger_touch(x, y)
  1145. return if $game_map.interpreter.running?
  1146. if @trigger == 2 and $game_player.pos?(x, y)
  1147. if @character_name != "" #### 追加部分 (ここから) ####
  1148. return unless $game_player.parallel?(self)
  1149. end #### 追加部分 (ここまで) ####
  1150. start if not jumping? and @priority_type == 1
  1151. end
  1152. end
  1153. end

  1154. #==============================================================================
  1155. # ■ Game_Vehicle
  1156. #------------------------------------------------------------------------------
  1157. #  乗り物を扱うクラスです。このクラスは Game_Map クラスの内部で使用されます。
  1158. # 現在のマップに乗り物がないときは、マップ座標 (-1,-1) に設定されます。
  1159. #==============================================================================

  1160. class Game_Vehicle < Game_Character
  1161. #--------------------------------------------------------------------------
  1162. # ○ タイル表示(on_tile)状態取得
  1163. #--------------------------------------------------------------------------
  1164. def on_tile
  1165. if @driving or @altitude > 0
  1166. return $game_player.on_tile
  1167. else
  1168. return false
  1169. end
  1170. end
  1171. #--------------------------------------------------------------------------
  1172. # ◎ プレイヤーとの同期
  1173. #--------------------------------------------------------------------------
  1174. alias tig_ew_sync_with_player sync_with_player
  1175. def sync_with_player
  1176. tig_ew_sync_with_player
  1177. update_turn_back
  1178. end
  1179. end

  1180. #==============================================================================
  1181. # ■ Game_Player
  1182. #------------------------------------------------------------------------------
  1183. #  プレイヤーを扱うクラスです。イベントの起動判定や、マップのスクロールなどの
  1184. # 機能を持っています。このクラスのインスタンスは $game_player で参照されます。
  1185. #==============================================================================

  1186. class Game_Player < Game_Character
  1187. #--------------------------------------------------------------------------
  1188. # ○ 公開インスタンス変数
  1189. #--------------------------------------------------------------------------
  1190. attr_accessor :game_map_data
  1191. attr_accessor :reserve_load_map_id
  1192. #--------------------------------------------------------------------------
  1193. # ◎ オブジェクト初期化
  1194. # map_id : マップ ID
  1195. # event : イベント (RPG::Event)
  1196. #--------------------------------------------------------------------------
  1197. alias tig_ew_pl_initialize initialize
  1198. def initialize
  1199. tig_ew_pl_initialize
  1200. @reserve_load_map_id = []
  1201. @game_map_data = {}
  1202. end
  1203. #--------------------------------------------------------------------------
  1204. # ○ マップデータの先読み
  1205. #--------------------------------------------------------------------------
  1206. def beforehand_load(map_id = @reserve_load_map_id)
  1207. for i in map_id
  1208. next if @game_map_data.key?(i)
  1209. map_data = Game_Map.new
  1210. map_data.setup(i)
  1211. @game_map_data[i] = map_data
  1212. end
  1213. for i in @game_map_data.keys.clone
  1214. unless map_id.include?(i)
  1215. @game_map_data.delete(i)
  1216. end
  1217. end
  1218. end
  1219. #--------------------------------------------------------------------------
  1220. # ◎ 場所移動の実行
  1221. #--------------------------------------------------------------------------
  1222. alias tig_ew_perform_transfer perform_transfer
  1223. def perform_transfer
  1224. return unless @transferring
  1225. unless $game_player.reserve_load_map_id.empty?
  1226. $game_player.beforehand_load
  1227. end
  1228. tig_ew_perform_transfer
  1229. end
  1230. #--------------------------------------------------------------------------
  1231. # ○ 浮かんでいるか?(乗り物拡張用・魔法の絨毯搭乗時)
  1232. #--------------------------------------------------------------------------
  1233. def floating?
  1234. return @vehicle_type == 5
  1235. end
  1236. #--------------------------------------------------------------------------
  1237. # ● 同位置のイベント起動判定
  1238. # triggers : トリガーの配列
  1239. #--------------------------------------------------------------------------
  1240. def check_event_trigger_here(triggers)
  1241. return false if $game_map.interpreter.running?
  1242. result = false
  1243. for event in $game_map.events_xy(@x, @y)
  1244. next unless parallel?(event) ##### 追加部分 (この行) #####
  1245. if triggers.include?(event.trigger) and event.priority_type != 1
  1246. event.start
  1247. result = true if event.starting
  1248. end
  1249. end
  1250. return result
  1251. end
  1252. #--------------------------------------------------------------------------
  1253. # ● 正面のイベント起動判定
  1254. # triggers : トリガーの配列
  1255. #--------------------------------------------------------------------------
  1256. def check_event_trigger_there(triggers)
  1257. return false if $game_map.interpreter.running?
  1258. result = false
  1259. front_x = $game_map.x_with_direction(@x, @direction)
  1260. front_y = $game_map.y_with_direction(@y, @direction)
  1261. for event in $game_map.events_xy(front_x, front_y)
  1262. next unless parallel?(event) ##### 追加部分 (この行) #####
  1263. if triggers.include?(event.trigger) and event.priority_type == 1
  1264. event.start
  1265. result = true
  1266. end
  1267. end
  1268. if result == false and $game_map.counter?(front_x, front_y)
  1269. front_x = $game_map.x_with_direction(front_x, @direction)
  1270. front_y = $game_map.y_with_direction(front_y, @direction)
  1271. for event in $game_map.events_xy(front_x, front_y)
  1272. next unless parallel?(event) ##### 追加部分 (この行) #####
  1273. if triggers.include?(event.trigger) and event.priority_type == 1
  1274. event.start
  1275. result = true
  1276. end
  1277. end
  1278. end
  1279. return result
  1280. end
  1281. #--------------------------------------------------------------------------
  1282. # ● 接触イベントの起動判定
  1283. # x : X 座標
  1284. # y : Y 座標
  1285. #--------------------------------------------------------------------------
  1286. def check_event_trigger_touch(x, y)
  1287. return false if $game_map.interpreter.running?
  1288. result = false
  1289. for event in $game_map.events_xy(x, y)
  1290. if event.character_name != "" #### 追加部分 (ここから) ####
  1291. next unless parallel?(event)
  1292. end #### 追加部分 (ここまで) ####
  1293. if [1,2].include?(event.trigger) and event.priority_type == 1
  1294. event.start
  1295. result = true
  1296. end
  1297. end
  1298. return result
  1299. end
  1300. #--------------------------------------------------------------------------
  1301. # ◎ 乗り物から降りる
  1302. # 現在乗り物に乗っていることが前提。
  1303. #--------------------------------------------------------------------------
  1304. alias tig_ew_get_off_vehicle get_off_vehicle
  1305. def get_off_vehicle
  1306. return if $game_map.back_tile?(@x, @y)
  1307. if @vehicle_type == 0 or @vehicle_type == 1
  1308. front_x = $game_map.x_with_direction(@x, @direction)
  1309. front_y = $game_map.y_with_direction(@y, @direction)
  1310. return if $game_map.wall?($game_map.point_tile_id(front_x, front_y)[0])
  1311. return if $game_map.under_bridge_passages[[front_x, front_y]] == 1
  1312. return if $game_map.prohibited_get_off.include?([front_x, front_y])
  1313. @no_turn_back = true
  1314. end
  1315. tig_ew_get_off_vehicle
  1316. end
  1317. end

  1318. #==============================================================================
  1319. # ■ Spriteset_Map
  1320. #------------------------------------------------------------------------------
  1321. #  マップ画面のスプライトやタイルマップなどをまとめたクラスです。このクラスは
  1322. # Scene_Map クラスの内部で使用されます。
  1323. #==============================================================================

  1324. class Spriteset_Map
  1325. #--------------------------------------------------------------------------
  1326. # ◎ ビューポートの作成
  1327. #--------------------------------------------------------------------------
  1328. alias tig_ew_create_viewports create_viewports
  1329. def create_viewports
  1330. tig_ew_create_viewports
  1331. @viewport4 = Viewport.new(0, 0, 544, 416) # 追加レイヤー用ビューポート
  1332. if Expansion_Passable::BACK_SEEING
  1333. @viewport5 = Viewport.new(0, 0, 544, 416) # 裏回りキャラ透過用ビューポート
  1334. end
  1335. if @viewport6 == nil
  1336. @viewport6 = Viewport.new(0, 0, 544, 416) # 色調変更用ビューポート
  1337. @viewport6.z = 25
  1338. end
  1339. end
  1340. #--------------------------------------------------------------------------
  1341. # ◎ タイルマップの作成
  1342. #--------------------------------------------------------------------------
  1343. alias tig_ew_create_tilemap create_tilemap
  1344. def create_tilemap
  1345. tig_ew_create_tilemap
  1346. setup_shadow_eraser_tilemap
  1347. @ex_tilemap = Tilemap.new(@viewport4)
  1348. @ex_tilemap.bitmaps[0] = Cache.system("TileA1")
  1349. @ex_tilemap.bitmaps[1] = Cache.system("TileA2")
  1350. @ex_tilemap.bitmaps[2] = Cache.system("TileA3")
  1351. @ex_tilemap.bitmaps[3] = Cache.system("TileA4")
  1352. @ex_tilemap.bitmaps[4] = Cache.system("TileA5")
  1353. @ex_tilemap.bitmaps[5] = Cache.system("TileB")
  1354. @ex_tilemap.bitmaps[6] = Cache.system("TileC")
  1355. @ex_tilemap.bitmaps[7] = Cache.system("TileD")
  1356. @ex_tilemap.bitmaps[8] = Cache.system("TileE")
  1357. @ex_tilemap.map_data = $game_map.ex_data
  1358. @ex_tilemap.passages = $game_map.passages
  1359. end
  1360. #--------------------------------------------------------------------------
  1361. # ○ 影消し処理用タイルの準備
  1362. #--------------------------------------------------------------------------
  1363. def setup_shadow_eraser_tilemap
  1364. for i in 1952...2048
  1365. @tilemap.passages[i] = 0x00
  1366. end
  1367. end
  1368. #--------------------------------------------------------------------------
  1369. # ◎ 飛行船の影スプライトの作成
  1370. #--------------------------------------------------------------------------
  1371. alias tig_ew_create_shadow create_shadow
  1372. def create_shadow
  1373. tig_ew_create_shadow
  1374. @shadow_sprite.viewport = @viewport4
  1375. end
  1376. #--------------------------------------------------------------------------
  1377. # ◎ タイルマップの解放
  1378. #--------------------------------------------------------------------------
  1379. alias tig_ew_dispose_tilemap dispose_tilemap
  1380. def dispose_tilemap
  1381. tig_ew_dispose_tilemap
  1382. @ex_tilemap.dispose
  1383. end
  1384. #--------------------------------------------------------------------------
  1385. # ◎ ビューポートの解放
  1386. #--------------------------------------------------------------------------
  1387. alias tig_ew_dispose_viewports dispose_viewports
  1388. def dispose_viewports
  1389. tig_ew_dispose_viewports
  1390. @viewport4.dispose
  1391. @viewport5.dispose if Expansion_Passable::BACK_SEEING
  1392. @viewport6.dispose if @viewport6 != nil
  1393. end
  1394. #--------------------------------------------------------------------------
  1395. # ◎ タイルマップの更新
  1396. #--------------------------------------------------------------------------
  1397. alias tig_ew_update_tilemap update_tilemap
  1398. def update_tilemap
  1399. tig_ew_update_tilemap
  1400. @ex_tilemap.ox = $game_map.display_x / 8
  1401. @ex_tilemap.oy = $game_map.display_y / 8
  1402. @ex_tilemap.update
  1403. end
  1404. #--------------------------------------------------------------------------
  1405. # ◎ キャラクタースプライトの更新
  1406. #--------------------------------------------------------------------------
  1407. alias tig_ew_update_characters update_characters
  1408. def update_characters
  1409. back_seeing_characters = []
  1410. for sprite in @character_sprites
  1411. if sprite.character.on_tile or sprite.character.priority_type == 2
  1412. sprite.viewport = @viewport4
  1413. else
  1414. sprite.viewport = @viewport1
  1415. end
  1416. next if sprite.character.not_back_seeing
  1417. if $game_player.turn_back and Expansion_Passable::BACK_SEEING
  1418. x = $game_player.x ; y = $game_player.y
  1419. if ($game_map.round_x(x-2)..$game_map.round_x(x+2)).include?(sprite.character.x) and
  1420. ($game_map.round_y(y-2)..$game_map.round_y(y+2)).include?(sprite.character.y)
  1421. back_seeing_characters.push(sprite.character)
  1422. end
  1423. end
  1424. end
  1425. back_seeing(back_seeing_characters)

  1426. tig_ew_update_characters
  1427. end
  1428. #--------------------------------------------------------------------------
  1429. # ○ 裏回りキャラ透過
  1430. #--------------------------------------------------------------------------
  1431. def back_seeing(characters)
  1432. return unless Expansion_Passable::BACK_SEEING
  1433. @back_seeing_sprites = [] if @back_seeing_sprites == nil
  1434. @characters = [] if @characters == nil
  1435. now_character = []
  1436. for character in characters
  1437. now_character.push(character)
  1438. unless @characters.include?(character)
  1439. new_sprite = Sprite_Character.new(@viewport5, character)
  1440. new_sprite.back_seeing = true
  1441. @back_seeing_sprites.push(new_sprite)
  1442. @characters.push(new_sprite.character)
  1443. end
  1444. end

  1445. for sprite in @back_seeing_sprites
  1446. if now_character.include?(sprite.character)
  1447. sprite.update
  1448. else
  1449. @characters.delete(sprite.character)
  1450. sprite.dispose
  1451. @back_seeing_sprites.delete(sprite)
  1452. end
  1453. end
  1454. end
  1455. #--------------------------------------------------------------------------
  1456. # ◎ フレーム更新
  1457. #--------------------------------------------------------------------------
  1458. alias tig_ew_update update
  1459. def update
  1460. tig_ew_update
  1461. update_ew_ex_viewports
  1462. end
  1463. #--------------------------------------------------------------------------
  1464. # ● ビューポートの更新
  1465. #--------------------------------------------------------------------------
  1466. def update_viewports
  1467. @viewport6.tone = $game_map.screen.tone ##### 修正部分 (この行) #####

  1468. @viewport1.ox = $game_map.screen.shake
  1469. @viewport2.color = $game_map.screen.flash_color
  1470. @viewport3.color.set(0, 0, 0, 255 - $game_map.screen.brightness)
  1471. @viewport1.update
  1472. @viewport2.update
  1473. @viewport3.update

  1474. @viewport6.update ##### 追加部分 (この行) #####
  1475. end
  1476. #--------------------------------------------------------------------------
  1477. # ○ 拡張ビューポートの更新
  1478. #--------------------------------------------------------------------------
  1479. def update_ew_ex_viewports
  1480. @viewport4.ox = $game_map.screen.shake
  1481. @viewport4.update
  1482. if Expansion_Passable::BACK_SEEING
  1483. @viewport5.rect.set($game_player.screen_x - 48, $game_player.screen_y - 64, 96, 96)
  1484. @viewport5.ox = $game_map.screen.shake
  1485. @viewport5.update
  1486. end
  1487. end
  1488. end

  1489. #==============================================================================
  1490. # ■ Sprite_Character
  1491. #------------------------------------------------------------------------------
  1492. #  キャラクター表示用のスプライトです。Game_Character クラスのインスタンスを
  1493. # 監視し、スプライトの状態を自動的に変化させます。
  1494. #==============================================================================

  1495. class Sprite_Character < Sprite_Base
  1496. #--------------------------------------------------------------------------
  1497. # ○ 公開インスタンス変数
  1498. #--------------------------------------------------------------------------
  1499. attr_accessor :back_seeing
  1500. #--------------------------------------------------------------------------
  1501. # ◎ オブジェクト初期化
  1502. # viewport : ビューポート
  1503. # character : キャラクター (Game_Character)
  1504. #--------------------------------------------------------------------------
  1505. alias tig_ew_initialize initialize
  1506. def initialize(viewport, character = nil)
  1507. tig_ew_initialize(viewport, character)
  1508. @back_seeing = false
  1509. end
  1510. #--------------------------------------------------------------------------
  1511. # ◎ フレーム更新
  1512. #--------------------------------------------------------------------------
  1513. alias tig_ew_update update
  1514. def update
  1515. tig_ew_update
  1516. if @back_seeing
  1517. self.opacity = 100 if self.opacity > 100
  1518. self.x -= $game_player.screen_x - 48
  1519. self.y -= $game_player.screen_y - 64
  1520. end
  1521. end
  1522. #--------------------------------------------------------------------------
  1523. # ◎ フキダシアイコン表示の開始
  1524. #--------------------------------------------------------------------------
  1525. alias tig_ew_start_balloon start_balloon
  1526. def start_balloon
  1527. tig_ew_start_balloon
  1528. @balloon_sprite.viewport = @viewport4
  1529. end
  1530. end

  1531. #==============================================================================
  1532. # ■ Scene_Title
  1533. #------------------------------------------------------------------------------
  1534. #  タイトル画面の処理を行うクラスです。
  1535. #==============================================================================

  1536. class Scene_Title < Scene_Base
  1537. #--------------------------------------------------------------------------
  1538. # ◎ 開始処理
  1539. #--------------------------------------------------------------------------
  1540. alias tig_ew_start start
  1541. def start
  1542. tig_ew_start
  1543. $game_map.create_ex_passages
  1544. end
  1545. #--------------------------------------------------------------------------
  1546. # ◎ データベースのロード
  1547. # name から<船の橋下通過>の設定を得ます。
  1548. #--------------------------------------------------------------------------
  1549. alias tig_ew_load_database load_database
  1550. def load_database
  1551. tig_ew_load_database
  1552. for area in $data_areas.values
  1553. area.name = area.name.sub(/[\<<]架け橋[\>>]/, "") # 名前の修正と
  1554. area.ship_pass = $& != nil # 船の橋下通過エリアの設定
  1555. area.name = area.name.sub(/[\<<]処理無視[\>>]/, "") # 名前の修正と
  1556. area.disregard_processing = $& != nil # 処理無視エリアの設定
  1557. end
  1558. end
  1559. end
复制代码




地图贴图:
  1. #==============================================================================
  2. # Multiple MapEffects 地图万花筒
  3. #
  4. # 源脚本:1:Ultimate Overlay Mapping(作者:Hanzo Kimura)
  5. # 2:Random Fadein(作者:Deity)
  6. # 3:Fade Toggle(作者:月绅士)
  7. # 4:Ultimate shadow remover(出处:http://rmvx.gameclover.com)
  8. #
  9. # 整合:我的米呀
  10. #
  11. # 版本:1.0(不确定后续有更新……)
  12. #
  13. # 说明:此脚本的设定部分分为两部分,第一部分为15行至33行,第二部分为183行
  14. # 至198行。包括的效果有四层地图贴图(感谢Hanzo的脚本),4种地图切换
  15. # 模式(感谢月绅士和Deity的脚本)。
  16. #
  17. #==============================================================================
  18. module HK_UOM

  19. #=============================设定部分PART I===================================#
  20. # 分辨率设定(请设定为你所使用的分辨率)
  21. Width = 544 # 屏幕的横长
  22. Height = 416 # 屏幕的纵长
  23. # 开关设定
  24. LightSwitch = 1 #光线开关
  25. ShadowSwitch = 2 #阴影开关
  26. ParSwitch = 3 #覆盖层开关
  27. GroundSwitch = 4 #地面层开关
  28. # 文件名设定
  29. LightMap = "Light" #光线的文件名
  30. ShadowMap = "Shadow" #阴影的文件名
  31. ParMap = "Par" #覆盖层的文件名
  32. GroundMap = "Ground" #地面层的文件名

  33. end
  34. module RandomFadein
  35. DURATION = 30 # 地图切换时间
  36. B_W = 100 # 切换图片的黑度
  37. end
  38. #==============================设定PART I结束 ===============================#


  39. ###################警告!随意改变以下部分者后果自负!########################
  40. ###################警告!随意改变以下部分者后果自负!########################
  41. ###################警告!随意改变以下部分者后果自负!########################


  42. include RandomFadein

  43. module Cache
  44. def self.overlay(filename)
  45. load_bitmap("Graphics/Overlays/", filename)
  46. end
  47. end
  48. class Game_Map
  49. alias gamebaker_goodbyeshadow_oldsetup setup
  50. def setup(*args)
  51. gamebaker_goodbyeshadow_oldsetup(*args)
  52. goodbye_shadows
  53. end

  54. def goodbye_shadows
  55. for x in 0...$game_map.data.xsize
  56. for y in 0...$game_map.data.ysize
  57. if $game_map.data[x,y,1] == 0
  58. $game_map.data[x,y,1] = $game_map.data[x,y,0]
  59. end
  60. end
  61. end
  62. end
  63. end
  64. class Spriteset_Map
  65. include HK_UOM
  66. alias hk_uom_initialize initialize
  67. def initialize
  68. @GroundON = FileTest.exist?("Graphics/Overlays/" + "ground" + $game_map.map_id.to_s + ".png")
  69. hk_uom_initialize
  70. update
  71. end
  72. alias hk_uom_create_parallax create_parallax
  73. def create_parallax
  74. if @GroundON
  75. @ground = Sprite.new(@viewport1)
  76. @ground.z = 1
  77. @ground.bitmap = Cache.overlay("ground" + $game_map.map_id.to_s)
  78. end
  79. hk_uom_create_parallax
  80. end
  81. alias hk_uom_dispose_parallax dispose_parallax
  82. def dispose_parallax
  83. if @ground != nil
  84. @ground.dispose
  85. end
  86. hk_uom_dispose_parallax
  87. end
  88. alias hk_uom_update_parallax update_parallax
  89. def update_parallax
  90. if @ground != nil
  91. @ground.visible = $game_switches[GroundSwitch]
  92. end
  93. if @ground != nil
  94. @ground.tone = $game_map.screen.tone
  95. @viewport1.ox = $game_map.screen.shake
  96. @viewport1.color = $game_map.screen.flash_color
  97. if @ground.ox != -$game_map.display_x / 256 or @ground.oy != -$game_map.display_y / 256 or @ground.ox == 0 or @ground.oy == 0
  98. @ground.ox = $game_map.display_x / 8
  99. @ground.oy = $game_map.display_y / 8
  100. end
  101. end
  102. hk_uom_update_parallax
  103. end
  104. end
  105. #==============================================================================
  106. # Scene Map
  107. #==============================================================================
  108. class Scene_Map < Scene_Base
  109. alias hk_uom_start start
  110. def start
  111. hk_uom_start
  112. $OverlayMap = Overlay_Map.new
  113. end
  114. def terminate
  115. super
  116. if $scene.is_a?(Scene_Battle)
  117. @spriteset.dispose_characters
  118. end
  119. snapshot_for_background
  120. @spriteset.dispose
  121. @message_window.dispose
  122. $OverlayMap.dispose
  123. if $scene.is_a?(Scene_Battle)
  124. perform_battle_transition
  125. end
  126. end
  127. def update
  128. super
  129. $game_map.interpreter.update
  130. $game_map.update
  131. $game_player.update
  132. $game_system.update
  133. @spriteset.update
  134. @message_window.update
  135. $OverlayMap.update
  136. unless $game_message.visible
  137. update_transfer_player
  138. update_encounter
  139. update_call_menu
  140. update_call_debug
  141. update_scene_change
  142. end
  143. end
  144. def fadein_deity
  145. transitions = Dir.entries("Graphics/Fadein/")
  146. effekt = rand (transitions.size - 2)
  147. Graphics.transition(DURATION,"Graphics/Fadein/"+transitions[effekt + 2], B_W)
  148. end
  149. def perform_transition
  150. if Graphics.brightness == 0
  151. fadein_deity
  152. else
  153. Graphics.transition(15)
  154. end
  155. end

  156. ###########################################################################
  157. ###########################################################################
  158. ###########################################################################


  159. #=====================设定部分PART II=====================================
  160. def update_transfer_player


  161. var_ID = 1 #地图切换的变量

  162. case $game_variables[var_ID]
  163. when 0 # 当该变量为0是使用默认模式
  164. normal_transfer
  165. when 1 # 当该变量为1时使用无淡入淡出模式
  166. fadeless_transfer
  167. when 2 # 当该变量为2时使用变亮模式
  168. white_screen_transfer
  169. when 3 # 当该变量为3时使用渐变图模式
  170. picture_transfer
  171. end
  172. end
  173. #=========================设定PART II结束 ===================================


  174. ###################警告!随意改变以下部分者后果自负!########################
  175. ###################警告!随意改变以下部分者后果自负!########################
  176. ###################警告!随意改变以下部分者后果自负!########################

  177. def normal_transfer
  178. return unless $game_player.transfer?
  179. return unless $game_player.transfer?
  180. fade = (Graphics.brightness > 0)
  181. fadeout(30) if fade
  182. @spriteset.dispose
  183. $game_player.perform_transfer
  184. $game_map.autoplay
  185. $game_map.update
  186. Graphics.wait(15)
  187. @spriteset = Spriteset_Map.new
  188. $OverlayMap.dispose
  189. $OverlayMap = Overlay_Map.new
  190. fadein(30) if fade
  191. Input.update
  192. end
  193. def fadeless_transfer
  194. return unless $game_player.transfer?
  195. @spriteset.dispose
  196. $game_player.perform_transfer
  197. $game_map.autoplay
  198. $game_map.update
  199. @spriteset = Spriteset_Map.new
  200. $OverlayMap.dispose
  201. $OverlayMap = Overlay_Map.new
  202. Input.update
  203. end

  204. def white_screen_transfer
  205. return unless $game_player.transfer?
  206. whitein(30)
  207. dummy = @spriteset
  208. $game_player.perform_transfer
  209. $game_map.autoplay
  210. $game_map.update
  211. @spriteset = Spriteset_Map.new
  212. $OverlayMap.dispose
  213. $OverlayMap = Overlay_Map.new
  214. whiteout(30)
  215. dummy.dispose
  216. Input.update
  217. end

  218. def whiteout(duration)
  219. for i in 0..duration-1
  220. c = 255 - 255 * i / duration
  221. $game_map.screen.start_flash(Color.new(c,c,c,c),30)
  222. update_basic
  223. end
  224. $game_map.screen.start_flash(Color.new(0,0,0,0),1)
  225. end

  226. def whitein(duration)
  227. for i in 0..duration-1
  228. c = 255 * i / duration
  229. $game_map.screen.start_flash(Color.new(c,c,c,c),30)
  230. update_basic
  231. end
  232. $game_map.screen.start_flash(Color.new(255,255,255,255),1)
  233. end
  234. def picture_transfer
  235. return unless $game_player.transfer?
  236. @spriteset.dispose
  237. @spriteset = Spriteset_Map.new
  238. $scene = Scene_Map.new
  239. fade = (Graphics.brightness > 0)
  240. fadeout(30) if fade
  241. @spriteset.dispose
  242. $game_player.perform_transfer
  243. $game_map.autoplay
  244. $game_map.update
  245. Graphics.wait(15)
  246. @spriteset = Spriteset_Map.new
  247. $OverlayMap.dispose
  248. $OverlayMap = Overlay_Map.new
  249. Input.update
  250. end
  251. end
  252. #==============================================================================
  253. # Overlay
  254. #==============================================================================
  255. class Overlay_Map
  256. include HK_UOM
  257. def initialize
  258. check_file
  259. display_overlay
  260. end
  261. def check_file
  262. @LightON = FileTest.exist?("Graphics/Overlays/" + LightMap + $game_map.map_id.to_s + ".png")
  263. @ShadowON = FileTest.exist?("Graphics/Overlays/" + ShadowMap + $game_map.map_id.to_s + ".jpg")
  264. @ParON = FileTest.exist?("Graphics/Overlays/" + ParMap + $game_map.map_id.to_s + ".png")
  265. @GroundON = FileTest.exist?("Graphics/Overlays/" + GroundMap + $game_map.map_id.to_s + ".png")
  266. end

  267. def display_overlay
  268. if @LightON
  269. @light_viewport = Viewport.new(0, 0, Width, Height)
  270. @light_viewport.z = 10
  271. @light = Sprite.new(@light_viewport)
  272. @light.bitmap = Cache.overlay(LightMap + $game_map.map_id.to_s)
  273. @light.z = 10
  274. @light.opacity = 115
  275. @light.blend_type = 1
  276. @light.visible = $game_switches[LightSwitch]
  277. end
  278. if @ShadowON
  279. @shadow_viewport = Viewport.new(0, 0, Width, Height)
  280. @shadow_viewport.z = 9
  281. @shadow = Sprite.new(@shadow_viewport)
  282. @shadow.bitmap = Cache.overlay(ShadowMap + $game_map.map_id.to_s)
  283. @shadow.z = 9
  284. @shadow.opacity = 85
  285. @shadow.blend_type = 2
  286. @shadow.visible = $game_switches[ShadowSwitch]
  287. end
  288. if @ParON
  289. @par_viewport = Viewport.new(0, 0, Width, Height)
  290. @par_viewport.z = 8
  291. @par = Sprite.new(@par_viewport)
  292. @par.z = 8
  293. @par.bitmap = Cache.overlay(ParMap + $game_map.map_id.to_s)
  294. @par.tone = $game_map.screen.tone
  295. @par.opacity = 255
  296. @par.blend_type = 0
  297. @par.visible = $game_switches[ParSwitch]
  298. end
  299. update
  300. end

  301. def update
  302. if @light != nil
  303. @light.visible = $game_switches[LightSwitch]
  304. end
  305. if @shadow != nil
  306. @shadow.visible = $game_switches[ShadowSwitch]
  307. end
  308. if @par != nil
  309. @par.visible = $game_switches[ParSwitch]
  310. end
  311. if @light != nil
  312. @light.tone = $game_map.screen.tone
  313. @light_viewport.ox = $game_map.screen.shake
  314. @light_viewport.color = $game_map.screen.flash_color
  315. if @light.x != $game_map.display_x / 256 or @light.y != $game_map.display_y / 256 or @light.x == 0 or @light.y == 0
  316. @light.ox = $game_map.display_x / 8
  317. @light.oy = $game_map.display_y / 8
  318. end
  319. end
  320. if @shadow != nil
  321. @shadow.tone = $game_map.screen.tone
  322. @shadow_viewport.ox = $game_map.screen.shake
  323. @shadow_viewport.color = $game_map.screen.flash_color
  324. if @shadow.x != $game_map.display_x / 256 or @shadow.y != $game_map.display_y / 256 or @shadow.x == 0 or @shadow.y == 0
  325. @shadow.ox = $game_map.display_x / 8
  326. @shadow.oy = $game_map.display_y / 8
  327. end
  328. end
  329. if @par != nil
  330. @par.tone = $game_map.screen.tone
  331. @par_viewport.ox = $game_map.screen.shake
  332. @par_viewport.color = $game_map.screen.flash_color
  333. if @par.ox != $game_map.display_x / 256 or @par.oy != $game_map.display_y / 256 or @par.ox == 0 or @par.oy == 0
  334. @par.ox = $game_map.display_x / 8
  335. @par.oy = $game_map.display_y / 8
  336. end
  337. end
  338. end
  339. def dispose
  340. if @light != nil
  341. @light_viewport.dispose
  342. @light.dispose
  343. end
  344. if @shadow != nil
  345. @shadow_viewport.dispose
  346. @shadow.dispose
  347. end
  348. if @par != nil
  349. @par_viewport.dispose
  350. @par.dispose
  351. end
  352. end
  353. end
复制代码

本人目前已被作业山压死,有事请烧(call)纸(me)……

Lv3.寻梦者

梦石
0
星屑
1314
在线时间
962 小时
注册时间
2012-4-30
帖子
1475

开拓者

2
发表于 2012-8-16 12:52:39 | 只看该作者
。。。壁扩张的话。。去月面工房看看。。不过月紳士大大也许不会去移植。。可以用Shift画法。。再用别的图块中的同样的来画在上面。。 效果还不错。。只是太浪费了。。。
不过地图万花筒的话。。我不是说了。。只需要改一小部分就好了嘛。。。(´Д`)。。

点评

铅笔酱好久不见。。。不过我已经找到VA的Overlays了呢。。。感谢喵。。。  发表于 2012-8-16 13:27
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-28 23:44

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表