Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 34.34 KB | None | 0 0
  1. #==============================================================================
  2. # +++ MOG - Weather EX (v2.3) +++
  3. #==============================================================================
  4. # By Moghunter
  5. # http://www.atelier-rgss.com/
  6. #==============================================================================
  7. # Sistema de clima com efeitos animados.
  8. #==============================================================================
  9. # As imagens usadas pelo sistema do clima devem ser gravadas na pasta
  10. #
  11. # GRAPHICS/WEATHER/
  12. #
  13. #==============================================================================
  14. # UTILIZAÇÃO
  15. #
  16. # Use o comando abaixo através da função chamar script.*(Evento)
  17. #
  18. # weather(TYPE, POWER, IMAGE_FILE)
  19. #
  20. # TYPE - Tipo de clima. (de 0 a 6)
  21. # POWER - Quantidade de partículas na tela. (de 1 a 10)
  22. # IMAGE_FILE - Nome da imagem.
  23. #
  24. # Exemplo (Eg)
  25. #
  26. # weather(0, 5, "Leaf")
  27. #
  28. #==============================================================================
  29. # Tipos de Clima.
  30. #
  31. # O sistema vem com 7 climas pré-configurados, que podem ser testados na demo
  32. # que vem com esse script.
  33. #
  34. # 0 - (Rain)
  35. # 1 - (Wind)
  36. # 2 - (Fog)
  37. # 3 - (Light)
  38. # 4 - (Snow)
  39. # 5 - (Spark)
  40. # 6 - (Random)
  41. # 7 - (Light Wind)
  42. # 8 - (Bubbles)
  43. #
  44. #==============================================================================
  45. # NOTA
  46. #
  47. # Evite de usar imagens muito pesadas ou de tamanho grande, caso for usar
  48. # diminua o poder do clima para evitar lag.
  49. #
  50. #==============================================================================
  51. #==============================================================================
  52. # Para parar o clima use o comando abaixo.
  53. #
  54. # weather_stop
  55. #==============================================================================
  56. # Para parar o clima após a batalha use o código abaixo.
  57. #
  58. # weather_stop_b
  59. #
  60. #==============================================================================
  61. # Para parar reativar o clima com as caracteríticas préviamente usadas use o
  62. # comando abaixo.
  63. #
  64. # weather_restore
  65. #==============================================================================
  66. # Se você precisar ativar um novo clima mas deseja gravar as caracteríticas
  67. # do clima atual para ser reativado depois use os códigos abaixo.
  68. #
  69. # weather_store
  70. # weather_restore_store
  71. #
  72. #==============================================================================
  73.  
  74. #==============================================================================
  75. # ● Histórico (Version History)
  76. #==============================================================================
  77. # v 2.3 - Compatibilidade com MOG Battle Camera.
  78. # v 2.2 - Adicionado o comando parar o clima após a batalha.
  79. # v 2.1 - Melhoria na posição das partículas durante as transições
  80. # de scenes.
  81. # v 2.0 - Correção do bug do Crash aleatório.
  82. #==============================================================================
  83. module MOG_WEATHER_EX
  84. #Prioridade do clima na tela.
  85. WEATHER_SCREEN_Z = 50
  86. #Definição da eficiência do poder do clima.
  87. #NOTA - Um valor muito alto pode causar lag, dependendo do tipo de clima e
  88. # imagem usada.
  89. WEATHER_POWER_EFIC = 5
  90. #Ativar o clima no sistema de batalha.
  91. WEATHER_BATTLE = true
  92. end
  93.  
  94. $imported = {} if $imported.nil?
  95. $imported[:mog_weather_ex] = true
  96.  
  97. #==============================================================================
  98. # ■ Cache
  99. #==============================================================================
  100. module Cache
  101.  
  102. #--------------------------------------------------------------------------
  103. # ● Weather
  104. #--------------------------------------------------------------------------
  105. def self.weather(filename)
  106. load_bitmap("Graphics/Weather/", filename)
  107. end
  108.  
  109. end
  110.  
  111. #==============================================================================
  112. # ■ Game System
  113. #==============================================================================
  114. class Game_System
  115.  
  116. attr_accessor :weather
  117. attr_accessor :weather_restore
  118. attr_accessor :weather_record_set
  119. attr_accessor :weather_temp
  120.  
  121. #--------------------------------------------------------------------------
  122. # ● Initialize
  123. #--------------------------------------------------------------------------
  124. alias weather_ex_initialize initialize
  125. def initialize
  126. @weather = [-1,0,""]
  127. @weather_restore = [-1,0,""]
  128. @weather_temp = [-1,0,""]
  129. @weather_record_set = [-1,0,""]
  130. weather_ex_initialize
  131. end
  132.  
  133. end
  134.  
  135. #==============================================================================
  136. # ■ Game Temp
  137. #==============================================================================
  138. class Game_Temp
  139.  
  140. attr_accessor :weather_ex_set
  141. attr_accessor :weather_fade
  142. attr_accessor :weather_rf_time
  143. attr_accessor :weather_fstop
  144.  
  145. #--------------------------------------------------------------------------
  146. # ● Initialize
  147. #--------------------------------------------------------------------------
  148. alias mog_weather_ex_temp_initialize initialize
  149. def initialize
  150. @weather_ex_set = []
  151. @weather_fade = false
  152. @weather_rf_time = 0
  153. @weather_fstop = false
  154. mog_weather_ex_temp_initialize
  155. end
  156.  
  157. end
  158.  
  159. #==============================================================================
  160. # ■ Game Interpreter
  161. #==============================================================================
  162. class Game_Interpreter
  163.  
  164. #--------------------------------------------------------------------------
  165. # ● Weather
  166. #--------------------------------------------------------------------------
  167. def weather(type = -1, power = 0, image = "")
  168. $game_temp.weather_fade = false
  169. $game_temp.weather_rf_time = 0
  170. $game_system.weather.clear
  171. $game_system.weather = [type,power,image]
  172. end
  173.  
  174. #--------------------------------------------------------------------------
  175. # ● Weather Stop
  176. #--------------------------------------------------------------------------
  177. def weather_stop
  178. $game_temp.weather_fade = false
  179. $game_system.weather.clear
  180. $game_system.weather = [-1,0,""]
  181. $game_system.weather_restore = [-1,0,""]
  182. $game_system.weather_temp = [-1,0,""]
  183. end
  184.  
  185. #--------------------------------------------------------------------------
  186. # ● Weather Restore
  187. #--------------------------------------------------------------------------
  188. def weather_restore
  189. $game_temp.weather_fade = false
  190. if $game_system.weather[0] != -1
  191. w = $game_system.weather
  192. $game_system.weather_restore = [w[0],w[1],w[2]]
  193. $game_system.weather.clear
  194. $game_system.weather = [-1,0,""]
  195. return
  196. end
  197. w = $game_system.weather_restore
  198. weather(w[0],w[1],w[2])
  199. end
  200.  
  201. #--------------------------------------------------------------------------
  202. # ● Weather Fade
  203. #--------------------------------------------------------------------------
  204. def weather_fade(value)
  205. $game_temp.weather_fade = value
  206. end
  207.  
  208. #--------------------------------------------------------------------------
  209. # ● Weather Store
  210. #--------------------------------------------------------------------------
  211. def weather_store
  212. w = $game_system.weather
  213. $game_system.weather_record_set = [w[0],w[1],w[2]]
  214. end
  215.  
  216. #--------------------------------------------------------------------------
  217. # ● Weather Restore Store
  218. #--------------------------------------------------------------------------
  219. def weather_restore_store
  220. w = $game_system.weather_record_set
  221. weather(w[0],w[1],w[2])
  222. end
  223.  
  224. #--------------------------------------------------------------------------
  225. # ● Weather Stop B
  226. #--------------------------------------------------------------------------
  227. def weather_stop_b
  228. $game_temp.weather_fstop = true
  229. end
  230.  
  231. end
  232.  
  233. #==============================================================================
  234. # ** Spriteset_Map
  235. #==============================================================================
  236. class Spriteset_Map
  237.  
  238. #--------------------------------------------------------------------------
  239. # * Create Viewport
  240. #--------------------------------------------------------------------------
  241. alias mog_weather_ex_create_viewports create_viewports
  242. def create_viewports
  243. create_viewport_weather
  244. mog_weather_ex_create_viewports
  245. end
  246.  
  247. #--------------------------------------------------------------------------
  248. # * Create Viewport Weather
  249. #--------------------------------------------------------------------------
  250. def create_viewport_weather
  251. return if @viewport_weather != nil
  252. @viewport_weather = Viewport.new
  253. @viewport_weather.z = MOG_WEATHER_EX::WEATHER_SCREEN_Z
  254. @viewport_weather.ox = ($game_map.display_x * 32)
  255. @viewport_weather.oy = ($game_map.display_y * 32)
  256. end
  257.  
  258. #--------------------------------------------------------------------------
  259. # * Dispose Viewports
  260. #--------------------------------------------------------------------------
  261. alias mog_weather_ex_dispose_viewports dispose_viewports
  262. def dispose_viewports
  263. mog_weather_ex_dispose_viewports
  264. dispose_viewport_weather
  265. end
  266.  
  267. #--------------------------------------------------------------------------
  268. # * Dispose Viewport Weather
  269. #--------------------------------------------------------------------------
  270. def dispose_viewport_weather
  271. return if @viewport_weather == nil
  272. @viewport_weather.dispose
  273. end
  274.  
  275. #--------------------------------------------------------------------------
  276. # * Update Viewports
  277. #--------------------------------------------------------------------------
  278. alias mog_weather_ex_update_viewports update_viewports
  279. def update_viewports
  280. mog_weather_ex_update_viewports
  281. update_viewport_weather
  282. end
  283.  
  284. #--------------------------------------------------------------------------
  285. # * Update Viewports Weather
  286. #--------------------------------------------------------------------------
  287. def update_viewport_weather
  288. return if @viewport_weather == nil
  289. @viewport_weather.ox = ($game_map.display_x * 32)
  290. @viewport_weather.oy = ($game_map.display_y * 32)
  291. end
  292.  
  293. end
  294.  
  295. #==============================================================================
  296. # ** Spriteset_Battle
  297. #==============================================================================
  298. class Spriteset_Battle
  299.  
  300. #--------------------------------------------------------------------------
  301. # * Create Viewport
  302. #--------------------------------------------------------------------------
  303. alias mog_weather_ex_create_viewports_battle create_viewports
  304. def create_viewports
  305. mog_weather_ex_create_viewports_battle
  306. create_viewport_weather
  307. end
  308.  
  309. #--------------------------------------------------------------------------
  310. # * Create Viewport Weather
  311. #--------------------------------------------------------------------------
  312. def create_viewport_weather
  313. return if @viewport_weather != nil
  314. @viewport_weather = Viewport.new
  315. @viewport_weather.z = MOG_WEATHER_EX::WEATHER_SCREEN_Z
  316. end
  317.  
  318. #--------------------------------------------------------------------------
  319. # * Dispose Viewports
  320. #--------------------------------------------------------------------------
  321. alias mog_weather_ex_dispose_viewports_battle dispose_viewports
  322. def dispose_viewports
  323. mog_weather_ex_dispose_viewports_battle
  324. dispose_viewport_weather
  325. end
  326.  
  327. #--------------------------------------------------------------------------
  328. # * Dispose Viewport Weather
  329. #--------------------------------------------------------------------------
  330. def dispose_viewport_weather
  331. return if @viewport_weather == nil
  332. @viewport_weather.dispose
  333. end
  334.  
  335. #--------------------------------------------------------------------------
  336. # * Update Viewports
  337. #--------------------------------------------------------------------------
  338. alias mog_weather_ex_update_viewports_battle update_viewports
  339. def update_viewports
  340. mog_weather_ex_update_viewports_battle
  341. update_viewport_weather
  342. end
  343.  
  344. #--------------------------------------------------------------------------
  345. # * Update Viewports Weather
  346. #--------------------------------------------------------------------------
  347. def update_viewport_weather
  348. return if @viewport_weather == nil
  349. if $imported[:mog_battle_camera]
  350. @viewport_weather.ox = $game_temp.viewport_oxy[0]
  351. @viewport_weather.oy = $game_temp.viewport_oxy[1]
  352. end
  353. end
  354.  
  355. end
  356.  
  357. #==============================================================================
  358. # ■ Weather_EX
  359. #==============================================================================
  360. class Weather_EX
  361.  
  362. #--------------------------------------------------------------------------
  363. # ● Initialize
  364. #--------------------------------------------------------------------------
  365. def initialize(viewport = nil ,type = 0, image_name = "",index = 0,nx,ny)
  366. @wp = Sprite.new
  367. @wp.bitmap = Cache.weather(image_name.to_s)
  368. @wp.opacity = 0
  369. @wp.viewport = viewport
  370. @cw = @wp.bitmap.width
  371. @cwm = (@cw / 2) + @cw
  372. @ch = @wp.bitmap.height
  373. @chm = (@ch / 2) + @ch
  374. @range_x = [-@cwm,Graphics.width + @cwm]
  375. @range_y = [-@chm,Graphics.height + @chm]
  376. @angle_speed = 0
  377. @x_speed = 0
  378. @y_speed = 0
  379. @zoom_speed = 0
  380. @opacity_speed = 0
  381. @type = type
  382. @index = index
  383. @nx = 0
  384. @nx_old = 0
  385. @ny = 0
  386. @ny_old = 0
  387. @old_nx = nx
  388. @old_ny = ny
  389. type_setup(nx,ny)
  390. end
  391.  
  392. #--------------------------------------------------------------------------
  393. # ● x
  394. #--------------------------------------------------------------------------
  395. def x
  396. @wp.x
  397. end
  398.  
  399. #--------------------------------------------------------------------------
  400. # ● y
  401. #--------------------------------------------------------------------------
  402. def y
  403. @wp.y
  404. end
  405.  
  406. #--------------------------------------------------------------------------
  407. # ● Opacity
  408. #--------------------------------------------------------------------------
  409. def opacity
  410. @wp.opacity
  411. end
  412.  
  413. #--------------------------------------------------------------------------
  414. # ● Angle
  415. #--------------------------------------------------------------------------
  416. def angle
  417. @wp.angle
  418. end
  419.  
  420. #--------------------------------------------------------------------------
  421. # ● Zoom X
  422. #--------------------------------------------------------------------------
  423. def zoom_x
  424. @wp.zoom_x
  425. end
  426.  
  427. #--------------------------------------------------------------------------
  428. # ● Dispose Weather
  429. #--------------------------------------------------------------------------
  430. def dispose_weather
  431. return if @wp == nil
  432. @wp.bitmap.dispose
  433. @wp.dispose
  434. @wp = nil
  435. end
  436.  
  437. #--------------------------------------------------------------------------
  438. # ● Pre Values
  439. #--------------------------------------------------------------------------
  440. def pre_values(index)
  441. return if $game_temp.weather_ex_set[index] == nil
  442. @wp.x = $game_temp.weather_ex_set[index][0]
  443. @wp.y = $game_temp.weather_ex_set[index][1]
  444. @wp.opacity = 1#$game_temp.weather_ex_set[index][2]
  445. @wp.angle = $game_temp.weather_ex_set[index][3]
  446. @wp.zoom_x = $game_temp.weather_ex_set[index][4]
  447. @wp.zoom_y = $game_temp.weather_ex_set[index][4]
  448. $game_temp.weather_ex_set[index].clear
  449. $game_temp.weather_ex_set[index] = nil
  450. end
  451.  
  452. #--------------------------------------------------------------------------
  453. # ● Type Setup
  454. #--------------------------------------------------------------------------
  455. def type_setup(nx = 0, ny = 0)
  456. @cw2 = [@range_x[1] + nx, @range_x[0] + nx]
  457. @ch2 = [@range_y[1] + ny, @range_y[0] + ny]
  458. check_weather_type
  459. pre_values(@index)
  460. @opacity_speed = -1 if $game_temp.weather_fade
  461. end
  462.  
  463. #--------------------------------------------------------------------------
  464. # ● Update
  465. #--------------------------------------------------------------------------
  466. def update_weather(nx = 0, ny = 0)
  467. @wp.x += @x_speed
  468. @wp.y += @y_speed
  469. @wp.opacity += @opacity_speed
  470. @wp.angle += @angle_speed
  471. @wp.zoom_x += @zoom_speed
  472. @wp.zoom_y += @zoom_speed
  473. check_loop_map(nx,ny)
  474. type_setup(nx,ny) if can_reset_setup?
  475. end
  476.  
  477. #--------------------------------------------------------------------------
  478. # ● Check Loop Map
  479. #--------------------------------------------------------------------------
  480. def check_loop_map(nx,ny)
  481. if (@old_nx - nx).abs > 32
  482. @cw2 = [@range_x[1] + nx, @range_x[0] + nx]
  483. @wp.x += nx
  484. @wp.x -= @old_nx if nx == 0
  485. end
  486. if (@old_ny - ny).abs > 32
  487. @ch2 = [@range_y[1] + ny, @range_y[0] + ny]
  488. @wp.y += ny
  489. @wp.y -= @old_ny if ny == 0
  490. end
  491. @old_nx = nx
  492. @old_ny = ny
  493. end
  494.  
  495. #--------------------------------------------------------------------------
  496. # ● Can Reset Setup
  497. #--------------------------------------------------------------------------
  498. def can_reset_setup?
  499. return true if @wp.x > @cw2[0] or @wp.x < @cw2[1]
  500. return true if @wp.y > @ch2[0] or @wp.y < @ch2[1]
  501. return true if @wp.opacity == 0
  502. return true if @wp.zoom_x > 2.0 or @wp.zoom_x < 0.5
  503. return false
  504. end
  505.  
  506. #--------------------------------------------------------------------------
  507. # ● Check Weather Type
  508. #--------------------------------------------------------------------------
  509. def check_weather_type
  510. case @type
  511. when 0; rain
  512. when 1; wind
  513. when 2; fog
  514. when 3; light
  515. when 4; snow
  516. when 5; spark
  517. when 6; random
  518. when 7; light_wind
  519. when 8; bubbles
  520. end
  521. end
  522.  
  523. #--------------------------------------------------------------------------
  524. # ● Snow
  525. #--------------------------------------------------------------------------
  526. def snow
  527. @wp.angle = rand(360)
  528. @wp.x = rand(@cw2[0])
  529. @wp.y = rand(@ch2[0])
  530. @wp.opacity = 1
  531. @wp.zoom_x = (rand(100) + 50) / 100.0
  532. @wp.zoom_y = @wp.zoom_x
  533. @y_speed = [[rand(5), 1].max, 5].min
  534. @opacity_speed = 5
  535. @angle_speed = rand(3)
  536. end
  537.  
  538. #--------------------------------------------------------------------------
  539. # ● Spark
  540. #--------------------------------------------------------------------------
  541. def spark
  542. @wp.angle = rand(360)
  543. @wp.x = rand(@cw2[0])
  544. @wp.y = rand(@ch2[0])
  545. @wp.opacity = 1
  546. @wp.zoom_x = (rand(100) + 100) / 100.0
  547. @wp.zoom_y = @wp.zoom_x
  548. @wp.blend_type = 1
  549. @opacity_speed = 10
  550. @zoom_speed = -0.01
  551. end
  552.  
  553. #--------------------------------------------------------------------------
  554. # ● Rain
  555. #--------------------------------------------------------------------------
  556. def rain
  557. @wp.x = rand(@cw2[0])
  558. if @start == nil
  559. @wp.y = rand(@ch2[0])
  560. @start = true
  561. else
  562. @wp.y = @ch2[1]
  563. end
  564. @wp.opacity = 1
  565. @wp.zoom_y = (rand(50) + 100) / 100.0
  566. @wp.zoom_x = (rand(25) + 100) / 100.0
  567. @y_speed = [[rand(10) + 10, 10].max, 20].min
  568. @opacity_speed = 10
  569. end
  570.  
  571. #--------------------------------------------------------------------------
  572. # ● Fog
  573. #--------------------------------------------------------------------------
  574. def fog
  575. rand_angle = rand(2)
  576. @wp.angle = rand_angle == 1 ? 180 : 0
  577. @wp.x = rand(@cw2[0])
  578. @wp.y = rand(@ch2[0])
  579. @wp.opacity = 1
  580. @wp.zoom_x = (rand(100) + 50) / 100.0
  581. @wp.zoom_y = @wp.zoom_x
  582. @x_speed = [[rand(10), 1].max, 10].min
  583. @opacity_speed = 10
  584. end
  585.  
  586. #--------------------------------------------------------------------------
  587. # ● Light
  588. #--------------------------------------------------------------------------
  589. def light
  590. @wp.angle = rand(360)
  591. @wp.x = rand(@cw2[0])
  592. @wp.y = rand(@ch2[0])
  593. @wp.opacity = 1
  594. @wp.zoom_x = (rand(100) + 50) / 100.0
  595. @wp.zoom_y = @wp.zoom_x
  596. @wp.blend_type = 1
  597. @angle_speed = [[rand(3), 1].max, 10].min
  598. @y_speed = -[[rand(10), 1].max, 10].min
  599. @opacity_speed = 2
  600. end
  601.  
  602. #--------------------------------------------------------------------------
  603. # ● Wind
  604. #--------------------------------------------------------------------------
  605. def wind
  606. @wp.angle = rand(360)
  607. @wp.x = rand(@cw2[0])
  608. @wp.y = rand(@ch2[0])
  609. @wp.opacity = 1
  610. @wp.zoom_x = (rand(100) + 50) / 100.0
  611. @wp.zoom_y = @wp.zoom_x
  612. @x_speed = [[rand(10), 1].max, 10].min
  613. @y_speed = [[rand(10), 1].max, 10].min
  614. @opacity_speed = 10
  615. end
  616.  
  617. #--------------------------------------------------------------------------
  618. # ● Light Wind
  619. #--------------------------------------------------------------------------
  620. def light_wind
  621. @wp.angle = rand(360)
  622. @wp.x = rand(Graphics.width/2)#rand(@cw2[0])
  623. @wp.y = rand(Graphics.height/2)#rand(@ch2[0])
  624. @wp.opacity = 1
  625. @wp.zoom_x = (rand(100) + 50) / 100.0
  626. @wp.zoom_y = @wp.zoom_x
  627. @x_speed = [[rand(10), 1].max, 4].min
  628. @y_speed = [[rand(10), 1].max, 2].min
  629. @opacity_speed = 10
  630. end
  631.  
  632.  
  633. # ● Bubbles
  634. def bubbles
  635. @wp.angle = rand(360)
  636. @wp.x = rand(@cw2[0])
  637. @wp.y = [rand(Graphics.height*2),(Graphics.height)].max #rand(@ch2[0])
  638. @wp.opacity = 1
  639. @wp.zoom_x = (rand(100) + 50) / 100.0
  640. @wp.zoom_y = @wp.zoom_x
  641. @wp.blend_type = 1
  642. @angle_speed = [[rand(3), 1].max, 10].min
  643. @y_speed = -[[rand(5), 1].max, 3].min
  644. @opacity_speed = 2
  645. end
  646.  
  647. #--------------------------------------------------------------------------
  648. # ● Random
  649. #--------------------------------------------------------------------------
  650. def random
  651. @wp.angle = rand(360)
  652. @wp.x = rand(@cw2[0])
  653. @wp.y = rand(@ch2[0])
  654. @wp.opacity = 1
  655. @wp.zoom_x = (rand(100) + 50) / 100.0
  656. @wp.zoom_y = @wp.zoom_x
  657. x_s = [[rand(10), 1].max, 10].min
  658. y_s = [[rand(10), 1].max, 10].min
  659. rand_x = rand(2)
  660. rand_y = rand(2)
  661. @x_speed = rand_x == 1 ? x_s : -x_s
  662. @y_speed = rand_y == 1 ? y_s : -y_s
  663. @opacity_speed = 10
  664. end
  665.  
  666. end
  667.  
  668. #==============================================================================
  669. # ■ Module Weather EX
  670. #==============================================================================
  671. module Module_Weather_EX
  672.  
  673. #--------------------------------------------------------------------------
  674. # ● Create Weather EX
  675. #--------------------------------------------------------------------------
  676. def create_weather_ex
  677. dispose_weather_ex
  678. create_weather_sprite
  679. end
  680.  
  681. #--------------------------------------------------------------------------
  682. # ● Dispose Wheater EX
  683. #--------------------------------------------------------------------------
  684. def dispose_weather_ex
  685. dispose_weather_ex_sprite
  686. end
  687.  
  688. #--------------------------------------------------------------------------
  689. # ● Create Weather Sprite
  690. #--------------------------------------------------------------------------
  691. def create_weather_sprite
  692. dispose_weather_ex_sprite
  693. @old_weather = $game_system.weather
  694. return if $game_system.weather == [] or $game_system.weather[0] == -1
  695. @weather_ex = []
  696. @weather_oxy = [$game_map.display_x * 32,
  697. $game_map.display_y * 32]
  698. index = 0
  699. power_efic = MOG_WEATHER_EX::WEATHER_POWER_EFIC
  700. power_efic = 1 if power_efic < 1
  701. power = [[$game_system.weather[1] * power_efic, power_efic].max, 999].min
  702. for i in 0...power
  703. @weather_ex.push(Weather_EX.new(@viewport_weather,$game_system.weather[0],$game_system.weather[2],index, @viewport1.ox, @viewport1.oy))
  704. index += 1
  705. end
  706. end
  707.  
  708. #--------------------------------------------------------------------------
  709. # ● Dispose Weather EX
  710. #--------------------------------------------------------------------------
  711. def dispose_weather_ex_sprite
  712. return if @weather_ex == nil
  713. index = 0
  714. for i in @weather_ex
  715. $game_temp.weather_ex_set[index] = [] if $game_temp.weather_ex_set[index] == nil
  716. $game_temp.weather_ex_set[index].push(i.x,i.y,i.opacity,i.angle,i.zoom_x)
  717. i.dispose_weather
  718. index += 1
  719. end
  720. @weather_ex.each {|sprite| sprite.dispose_weather}
  721. @weather_ex = nil
  722. end
  723.  
  724. #--------------------------------------------------------------------------
  725. # ● Dispose Refresh
  726. #--------------------------------------------------------------------------
  727. def dispose_refresh
  728. $game_temp.weather_ex_set.clear
  729. return if @weather_ex == nil
  730. @weather_ex.each {|sprite| sprite.dispose_weather}
  731. @weather_ex = nil
  732. end
  733.  
  734. #--------------------------------------------------------------------------
  735. # ● Update Weather EX
  736. #--------------------------------------------------------------------------
  737. def update_weather_ex
  738. $game_temp.weather_rf_time -= 1 if $game_temp.weather_rf_time > 0
  739. refresh_weather_ex if $game_temp.weather_rf_time == 0
  740. return if @weather_ex == nil
  741. @weather_ex.each {|sprite| sprite.update_weather(@viewport_weather.ox,@viewport_weather.oy)}
  742. end
  743.  
  744. #--------------------------------------------------------------------------
  745. # ● Refresh Weather EX
  746. #--------------------------------------------------------------------------
  747. def refresh_weather_ex
  748. return if @old_weather == nil
  749. return if @old_weather == $game_system.weather
  750. dispose_refresh
  751. create_weather_sprite
  752. end
  753.  
  754. end
  755.  
  756. #==============================================================================
  757. # ■ Spriteset Map
  758. #==============================================================================
  759. class Spriteset_Map
  760. include Module_Weather_EX
  761.  
  762. #--------------------------------------------------------------------------
  763. # ● Initialize
  764. #--------------------------------------------------------------------------
  765. alias mog_weather_ex_initialize initialize
  766. def initialize
  767. dispose_weather_ex
  768. mog_weather_ex_initialize
  769. create_weather_ex
  770. end
  771.  
  772. #--------------------------------------------------------------------------
  773. # ● Dispose
  774. #--------------------------------------------------------------------------
  775. alias mog_weather_ex_dispose dispose
  776. def dispose
  777. dispose_weather_ex
  778. mog_weather_ex_dispose
  779. end
  780.  
  781. #--------------------------------------------------------------------------
  782. # ● Update
  783. #--------------------------------------------------------------------------
  784. alias mog_weather_ex_update update
  785. def update
  786. mog_weather_ex_update
  787. update_weather_ex
  788. end
  789.  
  790. end
  791.  
  792. if MOG_WEATHER_EX::WEATHER_BATTLE
  793. #==============================================================================
  794. # ■ Spriteset Battle
  795. #==============================================================================
  796. class Spriteset_Battle
  797.  
  798. include Module_Weather_EX
  799.  
  800. #--------------------------------------------------------------------------
  801. # ● Initialize
  802. #--------------------------------------------------------------------------
  803. alias mog_weather_ex_initialize initialize
  804. def initialize
  805. dispose_weather_ex
  806. mog_weather_ex_initialize
  807. create_weather_ex
  808. end
  809.  
  810. #--------------------------------------------------------------------------
  811. # ● Dispose
  812. #--------------------------------------------------------------------------
  813. alias mog_weather_ex_dispose dispose
  814. def dispose
  815. mog_weather_ex_dispose
  816. dispose_weather_ex
  817. end
  818.  
  819. #--------------------------------------------------------------------------
  820. # ● Update
  821. #--------------------------------------------------------------------------
  822. alias mog_weather_ex_update update
  823. def update
  824. mog_weather_ex_update
  825. update_weather_ex
  826. end
  827.  
  828. end
  829.  
  830. end
  831.  
  832. #=============================================================================
  833. # ■ Scene Base
  834. #=============================================================================
  835. class Scene_Base
  836.  
  837. #--------------------------------------------------------------------------
  838. # ● Weather Recover Data
  839. #--------------------------------------------------------------------------
  840. def weather_recover_data
  841. if $game_system.weather.empty? or
  842. $game_system.weather[0] == -1
  843. if !$game_system.weather_restore.empty? and
  844. $game_system.weather_restore[0] != -1
  845. v = $game_system.weather_restore
  846. $game_system.weather = [v[0],v[1],v[2]]
  847. end
  848. end
  849. end
  850.  
  851. #--------------------------------------------------------------------------
  852. # ● Weather Restore
  853. #--------------------------------------------------------------------------
  854. def weather_recover_scene
  855. return if $game_system.weather_temp.empty?
  856. return if $game_system.weather_temp[0] == -1
  857. w = $game_system.weather_temp
  858. $game_system.weather = [w[0],w[1],w[2]]
  859. $game_system.weather_temp.clear
  860. $game_system.weather_temp = [-1,0,""]
  861. end
  862.  
  863. #--------------------------------------------------------------------------
  864. # ● Main
  865. #--------------------------------------------------------------------------
  866. alias mog_weather_ex_main main
  867. def main
  868. dispose_weather_ex_base
  869. weather_recover_scene if can_recover_weather_scene?
  870. mog_weather_ex_main
  871. end
  872.  
  873. #--------------------------------------------------------------------------
  874. # ● Can Recover Weather Scene
  875. #--------------------------------------------------------------------------
  876. def can_recover_weather_scene?
  877. return true if SceneManager.scene_is?(Scene_Map)
  878. return true if SceneManager.scene_is?(Scene_Battle)
  879. return false
  880. end
  881.  
  882. #--------------------------------------------------------------------------
  883. # ● terminate
  884. #--------------------------------------------------------------------------
  885. alias mog_weather_ex_terminate_base terminate
  886. def terminate
  887. mog_weather_ex_terminate_base
  888. dispose_weather_ex_base
  889. end
  890.  
  891. #--------------------------------------------------------------------------
  892. # ● Dispose Weather EX Base
  893. #--------------------------------------------------------------------------
  894. def dispose_weather_ex_base
  895. return if @spriteset == nil
  896. @spriteset.dispose_weather_ex rescue nil
  897. end
  898.  
  899. end
  900.  
  901. #=============================================================================
  902. # ■ Sprite Battle
  903. #=============================================================================
  904. class Spriteset_Battle
  905.  
  906. #--------------------------------------------------------------------------
  907. # ● Dispose
  908. #--------------------------------------------------------------------------
  909. alias mog_weather_ex_aft_dispose dispose
  910. def dispose
  911. force_stop_weather_ex_after_battle
  912. mog_weather_ex_aft_dispose
  913. end
  914.  
  915. #--------------------------------------------------------------------------
  916. # ● Force Stop Weather EX After
  917. #--------------------------------------------------------------------------
  918. def force_stop_weather_ex_after_battle
  919. return if !$game_temp.weather_fstop
  920. $game_temp.weather_fstop = false
  921. $game_temp.weather_fade = false
  922. $game_system.weather.clear
  923. $game_system.weather = [-1,0,""]
  924. $game_system.weather_restore = [-1,0,""]
  925. $game_system.weather_temp = [-1,0,""]
  926. end
  927.  
  928.  
  929. end
  930.  
  931. #=============================================================================
  932. # ■ Scene Load
  933. #=============================================================================
  934. class Scene_Load < Scene_File
  935.  
  936. #--------------------------------------------------------------------------
  937. # ● On Load Success
  938. #--------------------------------------------------------------------------
  939. alias mog_weather_ex_on_load_success on_load_success
  940. def on_load_success
  941. mog_weather_ex_on_load_success
  942. weather_recover_data
  943. end
  944. end
  945.  
  946. #=============================================================================
  947. # ■ Scene Manager
  948. #=============================================================================
  949. class << SceneManager
  950.  
  951. #--------------------------------------------------------------------------
  952. # ● Call
  953. #--------------------------------------------------------------------------
  954. alias mog_weather_ex_call call
  955. def call(scene_class)
  956. weather_dispose
  957. mog_weather_ex_call(scene_class)
  958. end
  959.  
  960. #--------------------------------------------------------------------------
  961. # ● Weather Restore
  962. #--------------------------------------------------------------------------
  963. def weather_dispose
  964. return if $game_system.weather.empty?
  965. return if $game_system.weather[0] == -1
  966. w = $game_system.weather
  967. $game_system.weather_temp = [w[0],w[1],w[2]]
  968. $game_system.weather.clear
  969. $game_system.weather = [-1,0,""]
  970. end
  971.  
  972. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement