mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 21:24:59 +00:00
Added decent spacing to all scripts thanks to Rubocop
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
# Based on version 2 by Near Fantastica, 04.01.06
|
||||
# In turn based on the Particle Engine designed by PinkMan
|
||||
class Particle_Engine
|
||||
def initialize(viewport = nil,map = nil)
|
||||
def initialize(viewport = nil, map = nil)
|
||||
@map = (map) ? map : $game_map
|
||||
@viewport = viewport
|
||||
@effect = []
|
||||
@@ -54,7 +54,7 @@ class Particle_Engine
|
||||
@effect.delete_at(event.id)
|
||||
end
|
||||
|
||||
def realloc_effect(event,particle)
|
||||
def realloc_effect(event, particle)
|
||||
type = pbEventCommentInput(event, 1, "Particle Engine Type")
|
||||
if type.nil?
|
||||
particle.dispose if particle
|
||||
@@ -68,13 +68,13 @@ class Particle_Engine
|
||||
end
|
||||
if !particle || !particle.is_a?(cls)
|
||||
particle.dispose if particle
|
||||
particle = cls.new(event,@viewport)
|
||||
particle = cls.new(event, @viewport)
|
||||
end
|
||||
return particle
|
||||
end
|
||||
|
||||
def pbParticleEffect(event)
|
||||
return realloc_effect(event,nil)
|
||||
return realloc_effect(event, nil)
|
||||
end
|
||||
|
||||
def update
|
||||
@@ -91,7 +91,7 @@ class Particle_Engine
|
||||
if particle.event.pe_refresh
|
||||
event = particle.event
|
||||
event.pe_refresh = false
|
||||
particle = realloc_effect(event,particle)
|
||||
particle = realloc_effect(event, particle)
|
||||
@effect[i] = particle
|
||||
end
|
||||
particle.update if particle
|
||||
@@ -153,21 +153,21 @@ class ParticleSprite
|
||||
def update
|
||||
w = Graphics.width
|
||||
h = Graphics.height
|
||||
if !@sprite && @x>=@minleft && @y>=@mintop && @x<w && @y<h
|
||||
if !@sprite && @x >= @minleft && @y >= @mintop && @x < w && @y < h
|
||||
@sprite = Sprite.new(@viewport)
|
||||
elsif @sprite && (@x<@minleft || @y<@mintop || @x>=w || @y>=h)
|
||||
elsif @sprite && (@x < @minleft || @y < @mintop || @x >= w || @y >= h)
|
||||
@sprite.dispose
|
||||
@sprite = nil
|
||||
end
|
||||
if @sprite
|
||||
@sprite.x = @x if @sprite.x!=@x
|
||||
@sprite.x = @x if @sprite.x != @x
|
||||
@sprite.x -= @ox
|
||||
@sprite.y = @y if @sprite.y!=@y
|
||||
@sprite.y = @y if @sprite.y != @y
|
||||
@sprite.y -= @oy
|
||||
@sprite.z = @z if @sprite.z!=@z
|
||||
@sprite.opacity = @opacity if @sprite.opacity!=@opacity
|
||||
@sprite.blend_type = @blend_type if @sprite.blend_type!=@blend_type
|
||||
@sprite.bitmap = @bitmap if @sprite.bitmap!=@bitmap
|
||||
@sprite.z = @z if @sprite.z != @z
|
||||
@sprite.opacity = @opacity if @sprite.opacity != @opacity
|
||||
@sprite.blend_type = @blend_type if @sprite.blend_type != @blend_type
|
||||
@sprite.bitmap = @bitmap if @sprite.bitmap != @bitmap
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -177,7 +177,7 @@ end
|
||||
class ParticleEffect_Event < ParticleEffect
|
||||
attr_accessor :event
|
||||
|
||||
def initialize(event,viewport = nil)
|
||||
def initialize(event, viewport = nil)
|
||||
@event = event
|
||||
@viewport = viewport
|
||||
@particles = []
|
||||
@@ -185,24 +185,24 @@ class ParticleEffect_Event < ParticleEffect
|
||||
end
|
||||
|
||||
def setParameters(params)
|
||||
@randomhue,@leftright,@fade,
|
||||
@maxparticless,@hue,@slowdown,
|
||||
@ytop,@ybottom,@xleft,@xright,
|
||||
@xgravity,@ygravity,@xoffset,@yoffset,
|
||||
@opacityvar,@originalopacity = params
|
||||
@randomhue, @leftright, @fade,
|
||||
@maxparticless, @hue, @slowdown,
|
||||
@ytop, @ybottom, @xleft, @xright,
|
||||
@xgravity, @ygravity, @xoffset, @yoffset,
|
||||
@opacityvar, @originalopacity = params
|
||||
end
|
||||
|
||||
def loadBitmap(filename,hue)
|
||||
key = [filename,hue]
|
||||
def loadBitmap(filename, hue)
|
||||
key = [filename, hue]
|
||||
bitmap = @bitmaps[key]
|
||||
if !bitmap || bitmap.disposed?
|
||||
bitmap = AnimatedBitmap.new("Graphics/Fogs/"+filename,hue).deanimate
|
||||
bitmap = AnimatedBitmap.new("Graphics/Fogs/" + filename, hue).deanimate
|
||||
@bitmaps[key] = bitmap
|
||||
end
|
||||
return bitmap
|
||||
end
|
||||
|
||||
def initParticles(filename,opacity,zOffset = 0,blendtype = 1)
|
||||
def initParticles(filename, opacity, zOffset = 0, blendtype = 1)
|
||||
@particles = []
|
||||
@particlex = []
|
||||
@particley = []
|
||||
@@ -222,15 +222,15 @@ class ParticleEffect_Event < ParticleEffect
|
||||
@particley[i] = -@yoffset
|
||||
@particles[i] = ParticleSprite.new(@viewport)
|
||||
@particles[i].bitmap = loadBitmap(filename, @hue) if filename
|
||||
if i==0 && @particles[i].bitmap
|
||||
if i == 0 && @particles[i].bitmap
|
||||
@bmwidth = @particles[i].bitmap.width
|
||||
@bmheight = @particles[i].bitmap.height
|
||||
end
|
||||
@particles[i].blend_type = blendtype
|
||||
@particles[i].y = @startingy
|
||||
@particles[i].x = @startingx
|
||||
@particles[i].z = self.z+zOffset
|
||||
@opacity[i] = rand(opacity/4)
|
||||
@particles[i].z = self.z + zOffset
|
||||
@opacity[i] = rand(opacity / 4)
|
||||
@particles[i].opacity = @opacity[i]
|
||||
@particles[i].update
|
||||
end
|
||||
@@ -253,28 +253,28 @@ class ParticleEffect_Event < ParticleEffect
|
||||
newRealY = @event.real_y
|
||||
@startingx = selfX + @xoffset
|
||||
@startingy = selfY + @yoffset
|
||||
@__offsetx = (@real_x==newRealX) ? 0 : selfX-@screen_x
|
||||
@__offsety = (@real_y==newRealY) ? 0 : selfY-@screen_y
|
||||
@__offsetx = (@real_x == newRealX) ? 0 : selfX - @screen_x
|
||||
@__offsety = (@real_y == newRealY) ? 0 : selfY - @screen_y
|
||||
@screen_x = selfX
|
||||
@screen_y = selfY
|
||||
@real_x = newRealX
|
||||
@real_y = newRealY
|
||||
if @opacityvar>0 && @viewport
|
||||
opac = 255.0/@opacityvar
|
||||
minX = opac*(-@xgravity*1.0 / @slowdown).floor + @startingx
|
||||
maxX = opac*(@xgravity*1.0 / @slowdown).floor + @startingx
|
||||
minY = opac*(-@ygravity*1.0 / @slowdown).floor + @startingy
|
||||
if @opacityvar > 0 && @viewport
|
||||
opac = 255.0 / @opacityvar
|
||||
minX = opac * (-@xgravity * 1.0 / @slowdown).floor + @startingx
|
||||
maxX = opac * (@xgravity * 1.0 / @slowdown).floor + @startingx
|
||||
minY = opac * (-@ygravity * 1.0 / @slowdown).floor + @startingy
|
||||
maxY = @startingy
|
||||
minX -= @bmwidth
|
||||
minY -= @bmheight
|
||||
maxX += @bmwidth
|
||||
maxY += @bmheight
|
||||
if maxX<0 || maxY<0 || minX>=Graphics.width || minY>=Graphics.height
|
||||
if maxX < 0 || maxY < 0 || minX >= Graphics.width || minY >= Graphics.height
|
||||
# echo "skipped"
|
||||
return
|
||||
end
|
||||
end
|
||||
particleZ = selfZ+@zoffset
|
||||
particleZ = selfZ + @zoffset
|
||||
for i in 0...@maxparticless
|
||||
@particles[i].z = particleZ
|
||||
if @particles[i].y <= @ytop
|
||||
@@ -333,19 +333,19 @@ class ParticleEffect_Event < ParticleEffect
|
||||
def calcParticlePos(i)
|
||||
@leftright = rand(2)
|
||||
if @leftright == 1
|
||||
xo = -@xgravity*1.0 / @slowdown
|
||||
xo = -@xgravity * 1.0 / @slowdown
|
||||
else
|
||||
xo = @xgravity*1.0 / @slowdown
|
||||
xo = @xgravity * 1.0 / @slowdown
|
||||
end
|
||||
yo = -@ygravity*1.0 / @slowdown
|
||||
yo = -@ygravity * 1.0 / @slowdown
|
||||
@particlex[i] += xo
|
||||
@particley[i] += yo
|
||||
@particlex[i] -= @__offsetx
|
||||
@particley[i] -= @__offsety
|
||||
@particlex[i] = @particlex[i].floor
|
||||
@particley[i] = @particley[i].floor
|
||||
@particles[i].x = @particlex[i]+@startingx+@xoffset
|
||||
@particles[i].y = @particley[i]+@startingy+@yoffset
|
||||
@particles[i].x = @particlex[i] + @startingx + @xoffset
|
||||
@particles[i].y = @particley[i] + @startingy + @yoffset
|
||||
end
|
||||
|
||||
def dispose
|
||||
@@ -363,33 +363,33 @@ end
|
||||
|
||||
|
||||
class Particle_Engine::Fire < ParticleEffect_Event
|
||||
def initialize(event,viewport)
|
||||
def initialize(event, viewport)
|
||||
super
|
||||
setParameters([0,0,1,20,40,0.5,-64,
|
||||
Graphics.height,-64,Graphics.width,0.5,0.10,-5,-13,30,0])
|
||||
initParticles("particle",250)
|
||||
setParameters([0, 0, 1, 20, 40, 0.5, -64,
|
||||
Graphics.height, -64, Graphics.width, 0.5, 0.10, -5, -13, 30, 0])
|
||||
initParticles("particle", 250)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
class Particle_Engine::Smoke < ParticleEffect_Event
|
||||
def initialize(event,viewport)
|
||||
def initialize(event, viewport)
|
||||
super
|
||||
setParameters([0,0,0,80,20,0.5,-64,
|
||||
Graphics.height,-64,Graphics.width,0.5,0.10,-5,-15,5,80])
|
||||
initParticles("smoke",250)
|
||||
setParameters([0, 0, 0, 80, 20, 0.5, -64,
|
||||
Graphics.height, -64, Graphics.width, 0.5, 0.10, -5, -15, 5, 80])
|
||||
initParticles("smoke", 250)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
class Particle_Engine::Teleport < ParticleEffect_Event
|
||||
def initialize(event,viewport)
|
||||
def initialize(event, viewport)
|
||||
super
|
||||
setParameters([1,1,1,10,rand(360),1,-64,
|
||||
Graphics.height,-64,Graphics.width,0,3,-8,-15,20,0])
|
||||
initParticles("wideportal",250)
|
||||
setParameters([1, 1, 1, 10, rand(360), 1, -64,
|
||||
Graphics.height, -64, Graphics.width, 0, 3, -8, -15, 20, 0])
|
||||
initParticles("wideportal", 250)
|
||||
for i in 0...@maxparticless
|
||||
@particles[i].ox = 16
|
||||
@particles[i].oy = 16
|
||||
@@ -400,55 +400,55 @@ end
|
||||
|
||||
|
||||
class Particle_Engine::Spirit < ParticleEffect_Event
|
||||
def initialize(event,viewport)
|
||||
def initialize(event, viewport)
|
||||
super
|
||||
setParameters([1,0,1,20,rand(360),0.5,-64,
|
||||
Graphics.height,-64,Graphics.width,0.5,0.10,-5,-13,30,0])
|
||||
initParticles("particle",250)
|
||||
setParameters([1, 0, 1, 20, rand(360), 0.5, -64,
|
||||
Graphics.height, -64, Graphics.width, 0.5, 0.10, -5, -13, 30, 0])
|
||||
initParticles("particle", 250)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
class Particle_Engine::Explosion < ParticleEffect_Event
|
||||
def initialize(event,viewport)
|
||||
def initialize(event, viewport)
|
||||
super
|
||||
setParameters([0,0,1,20,0,0.5,-64,
|
||||
Graphics.height,-64,Graphics.width,0.5,0.10,-5,-13,30,0])
|
||||
initParticles("explosion",250)
|
||||
setParameters([0, 0, 1, 20, 0, 0.5, -64,
|
||||
Graphics.height, -64, Graphics.width, 0.5, 0.10, -5, -13, 30, 0])
|
||||
initParticles("explosion", 250)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
class Particle_Engine::Aura < ParticleEffect_Event
|
||||
def initialize(event,viewport)
|
||||
def initialize(event, viewport)
|
||||
super
|
||||
setParameters([0,0,1,20,0,1,-64,
|
||||
Graphics.height,-64,Graphics.width,2,2,-5,-13,30,0])
|
||||
initParticles("particle",250)
|
||||
setParameters([0, 0, 1, 20, 0, 1, -64,
|
||||
Graphics.height, -64, Graphics.width, 2, 2, -5, -13, 30, 0])
|
||||
initParticles("particle", 250)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
class Particle_Engine::Soot < ParticleEffect_Event
|
||||
def initialize(event,viewport)
|
||||
def initialize(event, viewport)
|
||||
super
|
||||
setParameters([0,0,0,20,0,0.5,-64,
|
||||
Graphics.height,-64,Graphics.width,0.5,0.10,-5,-15,5,80])
|
||||
initParticles("smoke",100,0,2)
|
||||
setParameters([0, 0, 0, 20, 0, 0.5, -64,
|
||||
Graphics.height, -64, Graphics.width, 0.5, 0.10, -5, -15, 5, 80])
|
||||
initParticles("smoke", 100, 0, 2)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
class Particle_Engine::SootSmoke < ParticleEffect_Event
|
||||
def initialize(event,viewport)
|
||||
def initialize(event, viewport)
|
||||
super
|
||||
setParameters([0,0,0,30,0,0.5,-64,
|
||||
Graphics.height,-64,Graphics.width,0.5,0.10,-5,-15,5,80])
|
||||
initParticles("smoke",100,0)
|
||||
setParameters([0, 0, 0, 30, 0, 0.5, -64,
|
||||
Graphics.height, -64, Graphics.width, 0.5, 0.10, -5, -15, 5, 80])
|
||||
initParticles("smoke", 100, 0)
|
||||
for i in 0...@maxparticless
|
||||
@particles[i].blend_type = rand(6) < 3 ? 1 : 2
|
||||
end
|
||||
@@ -458,22 +458,22 @@ end
|
||||
|
||||
|
||||
class Particle_Engine::Rocket < ParticleEffect_Event
|
||||
def initialize(event,viewport)
|
||||
def initialize(event, viewport)
|
||||
super
|
||||
setParameters([0,0,0,60,0,0.5,-64,
|
||||
Graphics.height,-64,Graphics.width,0.5,0,-5,-15,5,80])
|
||||
initParticles("smoke",100,-1)
|
||||
setParameters([0, 0, 0, 60, 0, 0.5, -64,
|
||||
Graphics.height, -64, Graphics.width, 0.5, 0, -5, -15, 5, 80])
|
||||
initParticles("smoke", 100, -1)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
class Particle_Engine::FixedTeleport < ParticleEffect_Event
|
||||
def initialize(event,viewport)
|
||||
def initialize(event, viewport)
|
||||
super
|
||||
setParameters([1,0,1,10,rand(360),1,
|
||||
-Graphics.height,Graphics.height,0,Graphics.width,0,3,-8,-15,20,0])
|
||||
initParticles("wideportal",250)
|
||||
setParameters([1, 0, 1, 10, rand(360), 1,
|
||||
-Graphics.height, Graphics.height, 0, Graphics.width, 0, 3, -8, -15, 20, 0])
|
||||
initParticles("wideportal", 250)
|
||||
for i in 0...@maxparticless
|
||||
@particles[i].ox = 16
|
||||
@particles[i].oy = 16
|
||||
@@ -485,11 +485,11 @@ end
|
||||
|
||||
# By Peter O.
|
||||
class Particle_Engine::StarTeleport < ParticleEffect_Event
|
||||
def initialize(event,viewport)
|
||||
def initialize(event, viewport)
|
||||
super
|
||||
setParameters([0,0,1,10,0,1,
|
||||
-Graphics.height,Graphics.height,0,Graphics.width,0,3,-8,-15,10,0])
|
||||
initParticles("star",250)
|
||||
setParameters([0, 0, 1, 10, 0, 1,
|
||||
-Graphics.height, Graphics.height, 0, Graphics.width, 0, 3, -8, -15, 10, 0])
|
||||
initParticles("star", 250)
|
||||
for i in 0...@maxparticless
|
||||
@particles[i].ox = 48
|
||||
@particles[i].oy = 48
|
||||
@@ -500,59 +500,59 @@ end
|
||||
|
||||
|
||||
class Particle_Engine::Smokescreen < ParticleEffect_Event
|
||||
def initialize(event,viewport)
|
||||
def initialize(event, viewport)
|
||||
super
|
||||
setParameters([0,0,0,250,0,0.2,-64,
|
||||
Graphics.height,-64,Graphics.width,0.8,0.8,-5,-15,5,80])
|
||||
initParticles(nil,100)
|
||||
setParameters([0, 0, 0, 250, 0, 0.2, -64,
|
||||
Graphics.height, -64, Graphics.width, 0.8, 0.8, -5, -15, 5, 80])
|
||||
initParticles(nil, 100)
|
||||
for i in 0...@maxparticless
|
||||
rnd = rand(3)
|
||||
@opacity[i] = (rnd==0) ? 1 : 100
|
||||
filename = (rnd==0) ? "explosionsmoke" : "smoke"
|
||||
@opacity[i] = (rnd == 0) ? 1 : 100
|
||||
filename = (rnd == 0) ? "explosionsmoke" : "smoke"
|
||||
@particles[i].bitmap = loadBitmap(filename, @hue)
|
||||
end
|
||||
end
|
||||
|
||||
def calcParticlePos(i)
|
||||
if @randomhue==1
|
||||
filename = (rand(3)==0) ? "explosionsmoke" : "smoke"
|
||||
if @randomhue == 1
|
||||
filename = (rand(3) == 0) ? "explosionsmoke" : "smoke"
|
||||
@particles[i].bitmap = loadBitmap(filename, @hue)
|
||||
end
|
||||
multiple = 1.7
|
||||
xgrav = @xgravity*multiple/@slowdown
|
||||
xgrav = -xgrav if (rand(2)==1)
|
||||
ygrav = @ygravity*multiple/@slowdown
|
||||
ygrav = -ygrav if (rand(2)==1)
|
||||
xgrav = @xgravity * multiple / @slowdown
|
||||
xgrav = -xgrav if (rand(2) == 1)
|
||||
ygrav = @ygravity * multiple / @slowdown
|
||||
ygrav = -ygrav if (rand(2) == 1)
|
||||
@particlex[i] += xgrav
|
||||
@particley[i] += ygrav
|
||||
@particlex[i] -= @__offsetx
|
||||
@particley[i] -= @__offsety
|
||||
@particlex[i] = @particlex[i].floor
|
||||
@particley[i] = @particley[i].floor
|
||||
@particles[i].x = @particlex[i]+@startingx+@xoffset
|
||||
@particles[i].y = @particley[i]+@startingy+@yoffset
|
||||
@particles[i].x = @particlex[i] + @startingx + @xoffset
|
||||
@particles[i].y = @particley[i] + @startingy + @yoffset
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
class Particle_Engine::Flare < ParticleEffect_Event
|
||||
def initialize(event,viewport)
|
||||
def initialize(event, viewport)
|
||||
super
|
||||
setParameters([0,0,1,30,10,1,-64,
|
||||
Graphics.height,-64,Graphics.width,2,2,-5,-12,30,0])
|
||||
initParticles("particle",255)
|
||||
setParameters([0, 0, 1, 30, 10, 1, -64,
|
||||
Graphics.height, -64, Graphics.width, 2, 2, -5, -12, 30, 0])
|
||||
initParticles("particle", 255)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
class Particle_Engine::Splash < ParticleEffect_Event
|
||||
def initialize(event,viewport)
|
||||
def initialize(event, viewport)
|
||||
super
|
||||
setParameters([0,0,1,30,255,1,-64,
|
||||
Graphics.height,-64,Graphics.width,4,2,-5,-12,30,0])
|
||||
initParticles("smoke",50)
|
||||
setParameters([0, 0, 1, 30, 255, 1, -64,
|
||||
Graphics.height, -64, Graphics.width, 4, 2, -5, -12, 30, 0])
|
||||
initParticles("smoke", 50)
|
||||
end
|
||||
|
||||
def update
|
||||
@@ -570,7 +570,7 @@ class Game_Event < Game_Character
|
||||
attr_accessor :pe_refresh
|
||||
|
||||
alias nf_particles_game_map_initialize initialize
|
||||
def initialize(map_id,event,map = nil)
|
||||
def initialize(map_id, event, map = nil)
|
||||
@pe_refresh = false
|
||||
begin
|
||||
nf_particles_game_map_initialize(map_id, event, map)
|
||||
|
||||
Reference in New Issue
Block a user