#================================================================
# Cross Multifog system (2.2)
# por Alex Crosslight
# [url=http://ateliercross.6te.net]http://ateliercross.6te.net[/url]
#################################################################
# Histórico:
#################################################################
#
# Versão 1.0
#
# > Atribui uma fog simultânea ao mapa
#
# Versão 1.5
#
# > A fog é salva junto com o game_system
# > Você pode chamar mais de uma fog simultânea.
#
# Versão 2.0
#
# > Bugs quanto a criação de fogs e mudança de tal corrigida.
# > Adicionado os métodos de remoção de fog e zeramento de fogs.
#
# Versão 2.1
#
# > Bugs no blend foram corrigidos por Kress.
#
# Versão 2.2
#
# > Bugs em várias funções foram corrigidos por Kress.
# > Script totalmente funcional, com uma função nova: Hue
#
#================================================================
# O script permite atribuir mais de uma fog simultânea
# além da definida no mapa.
#================================================================
# >> Use o comando chamar script e digite:
# > create_fog(name,ox,oy,opacity,z,blend,magn,hue)
#
# name = nome do fog entre "aspas"
# ox = velocidade na horizontal
# oy = velocidade na vertical
# opacity = opacidade
# z = Prioridade da fog, também servirá de ID para ela
# blend = Sinteticidade da fog (0 - normal, 1 - inverter, 2 - multiplicar)
# magn = magnitude da fog
# hue = tonalidade da nevoa (novo)
#
# >> Para apagar uma fog, use o comando:
#
# > remove_fog(z)
#
# z é a ID da fog, ou a prioridade dela configurada anteriormente.
#
# >> Para deletar todas as fogs, use o comando:
#
# > clear_multifog
#
#================================================================
# INICIO DO SCRIPT
#================================================================
#==============================================================================
# Game_System
#==============================================================================
class Game_System
attr_accessor :multifog
attr_accessor :eraser_multifog
attr_accessor :coor_origin
#--------------------------------------------------------------------------
# Inicialização dos Objetos
#--------------------------------------------------------------------------
alias multifog_initialize initialize
def initialize
multifog_initialize
@multifog = {}
@eraser_multifog = "none"
@coor_origin = {}
end
end
#==============================================================================
# Interpreter
#==============================================================================
class Interpreter
def create_fog(name,ox,oy,opacity,z,blend,magn,hue)
$game_system.multifog[z] = [name,ox,oy,opacity,z,blend,magn,hue]
end
def remove_fog(z)
unless $game_system.multifog[z] == nil
$game_system.multifog.delete_if{|key, value| key == z }
$game_system.eraser_multifog = z
end
end
def clear_multifog
unless $game_system.multifog.keys.size < 1
$game_system.eraser_multifog = "all"
end
end
end
#==============================================================================
# Spriteset_Map
#==============================================================================
class Spriteset_Map
#--------------------------------------------------------------------------
# Inicialização dos Objetos
#--------------------------------------------------------------------------
alias multifog_initialize initialize
def initialize
multifog_initialize
@neo_multifog = {} if @neo_multifog == nil
@neo_multifog2 = {} if @neo_multifog2 == nil
end
#--------------------------------------------------------------------------
# Apagar objetos
#--------------------------------------------------------------------------
alias multifog_dispose dispose
def dispose
multifog_dispose
dispose_one_new_p
end
#--------------------------------------------------------------------------
# Criar novos objetos
#--------------------------------------------------------------------------
def create_new_plane
@neo_multifog2 = {} if @neo_multifog2 == nil
for n in $game_system.multifog.keys
unless @neo_multifog2[n] == nil
@neo_multifog2[n].dispose
end
@neo_multifog2[n] = Plane.new(@viewport1)
@neo_multifog2[n].bitmap = RPG::Cache.fog($game_system.multifog[n][0],
$game_system.multifog[n][7])
@neo_multifog2[n].opacity = $game_system.multifog[n][3]
@neo_multifog2[n].z = (3000 + (n + 1))
@neo_multifog2[n].blend_type = $game_system.multifog[n][5]
@neo_multifog2[n].zoom_x = $game_system.multifog[n][6].to_f / 100.00
@neo_multifog2[n].zoom_y = $game_system.multifog[n][6].to_f / 100.00
end
end
#--------------------------------------------------------------------------
# Apagar novos objetos
#--------------------------------------------------------------------------
def dispose_new_plane
if $game_system.multifog.keys.size != 0
for n in $game_system.multifog.keys
@neo_multifog2[n].dispose
end
$game_system.multifog = {}
end
end
#--------------------------------------------------------------------------
# Apagar novos objetos
#--------------------------------------------------------------------------
def dispose_one_new_p
if $game_system.multifog.keys.size != 0
for n in $game_system.multifog.keys
@neo_multifog2[n].dispose unless @neo_multifog2[n] == nil or @neo_multifog2[n].disposed?
end
end
end
#--------------------------------------------------------------------------
# Atualização do Frame
#--------------------------------------------------------------------------
alias multifog_n_update update
def update
multifog_n_update
if $game_system.eraser_multifog != "none"
if $game_system.eraser_multifog.is_a?(Integer)
if @neo_multifog2.keys.include?($game_system.eraser_multifog)
@neo_multifog2[$game_system.eraser_multifog].dispose
$game_system.eraser_multifog = "none"
end
elsif $game_system.eraser_multifog == "all"
dispose_new_plane
$game_system.eraser_multifog = "none"
end
end
if $game_system.multifog.values != @neo_multifog
@neo_multifog = $game_system.multifog.values
create_new_plane
end
for n in $game_system.multifog.keys
if $game_system.coor_origin[n] == nil
$game_system.coor_origin[n] = [0,0]
#$game_system.coor_origin[n].push(0)
end
end
for n in $game_system.multifog.keys
$game_system.coor_origin[n][0] -= $game_system.multifog[n][1] / 8.0
$game_system.coor_origin[n][1] -= $game_system.multifog[n][2] / 8.0
end
for n in $game_system.multifog.keys
unless $game_system.multifog[n][1] == 0
@neo_multifog2[n].ox = $game_map.display_x / 4 +
$game_system.multifog[n][1]
else
@neo_multifog2[n].ox -= $game_system.multifog[n][1]
end
unless $game_system.multifog[n][2] != 0
@neo_multifog2[n].oy = $game_map.display_y / 4 +
$game_system.multifog[n][2]
else
@neo_multifog2[n].oy -= $game_system.multifog[n][2]
end
end
end
end
#================================================================
# FIM DO SCRIPT =*
#================================================================