mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Fixed back-to-back changes to backgrounds in battle animations not finishing properly before the next one starts
This commit is contained in:
@@ -471,6 +471,49 @@ class PBAnimation < Array
|
|||||||
end
|
end
|
||||||
|
|
||||||
def playTiming(frame, bgGraphic, bgColor, foGraphic, foColor, oldbg = [], oldfo = [], user = nil)
|
def playTiming(frame, bgGraphic, bgColor, foGraphic, foColor, oldbg = [], oldfo = [], user = nil)
|
||||||
|
@timing.each do |i|
|
||||||
|
next if !i.duration || i.duration <= 0
|
||||||
|
next if i.frame + i.duration < frame || i.frame >= frame
|
||||||
|
fraction = (frame - i.frame).to_f / i.duration
|
||||||
|
case i.timingType
|
||||||
|
when 2
|
||||||
|
if bgGraphic.bitmap.nil?
|
||||||
|
bgColor.opacity = oldbg[2] + ((i.opacity - oldbg[2]) * fraction) if i.opacity
|
||||||
|
cr = (i.colorRed) ? oldbg[3].red + ((i.colorRed - oldbg[3].red) * fraction) : oldbg[3].red
|
||||||
|
cg = (i.colorGreen) ? oldbg[3].green + ((i.colorGreen - oldbg[3].green) * fraction) : oldbg[3].green
|
||||||
|
cb = (i.colorBlue) ? oldbg[3].blue + ((i.colorBlue - oldbg[3].blue) * fraction) : oldbg[3].blue
|
||||||
|
ca = (i.colorAlpha) ? oldbg[3].alpha + ((i.colorAlpha - oldbg[3].alpha) * fraction) : oldbg[3].alpha
|
||||||
|
bgColor.color = Color.new(cr, cg, cb, ca)
|
||||||
|
else
|
||||||
|
bgGraphic.ox = oldbg[0] - ((i.bgX - oldbg[0]) * fraction) if i.bgX
|
||||||
|
bgGraphic.oy = oldbg[1] - ((i.bgY - oldbg[1]) * fraction) if i.bgY
|
||||||
|
bgGraphic.opacity = oldbg[2] + ((i.opacity - oldbg[2]) * fraction) if i.opacity
|
||||||
|
cr = (i.colorRed) ? oldbg[3].red + ((i.colorRed - oldbg[3].red) * fraction) : oldbg[3].red
|
||||||
|
cg = (i.colorGreen) ? oldbg[3].green + ((i.colorGreen - oldbg[3].green) * fraction) : oldbg[3].green
|
||||||
|
cb = (i.colorBlue) ? oldbg[3].blue + ((i.colorBlue - oldbg[3].blue) * fraction) : oldbg[3].blue
|
||||||
|
ca = (i.colorAlpha) ? oldbg[3].alpha + ((i.colorAlpha - oldbg[3].alpha) * fraction) : oldbg[3].alpha
|
||||||
|
bgGraphic.color = Color.new(cr, cg, cb, ca)
|
||||||
|
end
|
||||||
|
when 4
|
||||||
|
if foGraphic.bitmap.nil?
|
||||||
|
foColor.opacity = oldfo[2] + ((i.opacity - oldfo[2]) * fraction) if i.opacity
|
||||||
|
cr = (i.colorRed) ? oldfo[3].red + ((i.colorRed - oldfo[3].red) * fraction) : oldfo[3].red
|
||||||
|
cg = (i.colorGreen) ? oldfo[3].green + ((i.colorGreen - oldfo[3].green) * fraction) : oldfo[3].green
|
||||||
|
cb = (i.colorBlue) ? oldfo[3].blue + ((i.colorBlue - oldfo[3].blue) * fraction) : oldfo[3].blue
|
||||||
|
ca = (i.colorAlpha) ? oldfo[3].alpha + ((i.colorAlpha - oldfo[3].alpha) * fraction) : oldfo[3].alpha
|
||||||
|
foColor.color = Color.new(cr, cg, cb, ca)
|
||||||
|
else
|
||||||
|
foGraphic.ox = oldfo[0] - ((i.bgX - oldfo[0]) * fraction) if i.bgX
|
||||||
|
foGraphic.oy = oldfo[1] - ((i.bgY - oldfo[1]) * fraction) if i.bgY
|
||||||
|
foGraphic.opacity = oldfo[2] + ((i.opacity - oldfo[2]) * fraction) if i.opacity
|
||||||
|
cr = (i.colorRed) ? oldfo[3].red + ((i.colorRed - oldfo[3].red) * fraction) : oldfo[3].red
|
||||||
|
cg = (i.colorGreen) ? oldfo[3].green + ((i.colorGreen - oldfo[3].green) * fraction) : oldfo[3].green
|
||||||
|
cb = (i.colorBlue) ? oldfo[3].blue + ((i.colorBlue - oldfo[3].blue) * fraction) : oldfo[3].blue
|
||||||
|
ca = (i.colorAlpha) ? oldfo[3].alpha + ((i.colorAlpha - oldfo[3].alpha) * fraction) : oldfo[3].alpha
|
||||||
|
foGraphic.color = Color.new(cr, cg, cb, ca)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@timing.each do |i|
|
@timing.each do |i|
|
||||||
next if i.frame != frame
|
next if i.frame != frame
|
||||||
case i.timingType
|
case i.timingType
|
||||||
@@ -539,52 +582,6 @@ class PBAnimation < Array
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@timing.each do |i|
|
|
||||||
case i.timingType
|
|
||||||
when 2
|
|
||||||
next if !i.duration || i.duration <= 0
|
|
||||||
next if frame < i.frame || frame > i.frame + i.duration
|
|
||||||
fraction = (frame - i.frame).to_f / i.duration
|
|
||||||
if bgGraphic.bitmap.nil?
|
|
||||||
bgColor.opacity = oldbg[2] + ((i.opacity - oldbg[2]) * fraction) if i.opacity
|
|
||||||
cr = (i.colorRed) ? oldbg[3].red + ((i.colorRed - oldbg[3].red) * fraction) : oldbg[3].red
|
|
||||||
cg = (i.colorGreen) ? oldbg[3].green + ((i.colorGreen - oldbg[3].green) * fraction) : oldbg[3].green
|
|
||||||
cb = (i.colorBlue) ? oldbg[3].blue + ((i.colorBlue - oldbg[3].blue) * fraction) : oldbg[3].blue
|
|
||||||
ca = (i.colorAlpha) ? oldbg[3].alpha + ((i.colorAlpha - oldbg[3].alpha) * fraction) : oldbg[3].alpha
|
|
||||||
bgColor.color = Color.new(cr, cg, cb, ca)
|
|
||||||
else
|
|
||||||
bgGraphic.ox = oldbg[0] - ((i.bgX - oldbg[0]) * fraction) if i.bgX
|
|
||||||
bgGraphic.oy = oldbg[1] - ((i.bgY - oldbg[1]) * fraction) if i.bgY
|
|
||||||
bgGraphic.opacity = oldbg[2] + ((i.opacity - oldbg[2]) * fraction) if i.opacity
|
|
||||||
cr = (i.colorRed) ? oldbg[3].red + ((i.colorRed - oldbg[3].red) * fraction) : oldbg[3].red
|
|
||||||
cg = (i.colorGreen) ? oldbg[3].green + ((i.colorGreen - oldbg[3].green) * fraction) : oldbg[3].green
|
|
||||||
cb = (i.colorBlue) ? oldbg[3].blue + ((i.colorBlue - oldbg[3].blue) * fraction) : oldbg[3].blue
|
|
||||||
ca = (i.colorAlpha) ? oldbg[3].alpha + ((i.colorAlpha - oldbg[3].alpha) * fraction) : oldbg[3].alpha
|
|
||||||
bgGraphic.color = Color.new(cr, cg, cb, ca)
|
|
||||||
end
|
|
||||||
when 4
|
|
||||||
next if !i.duration || i.duration <= 0
|
|
||||||
next if frame < i.frame || frame > i.frame + i.duration
|
|
||||||
fraction = (frame - i.frame).to_f / i.duration
|
|
||||||
if foGraphic.bitmap.nil?
|
|
||||||
foColor.opacity = oldfo[2] + ((i.opacity - oldfo[2]) * fraction) if i.opacity
|
|
||||||
cr = (i.colorRed) ? oldfo[3].red + ((i.colorRed - oldfo[3].red) * fraction) : oldfo[3].red
|
|
||||||
cg = (i.colorGreen) ? oldfo[3].green + ((i.colorGreen - oldfo[3].green) * fraction) : oldfo[3].green
|
|
||||||
cb = (i.colorBlue) ? oldfo[3].blue + ((i.colorBlue - oldfo[3].blue) * fraction) : oldfo[3].blue
|
|
||||||
ca = (i.colorAlpha) ? oldfo[3].alpha + ((i.colorAlpha - oldfo[3].alpha) * fraction) : oldfo[3].alpha
|
|
||||||
foColor.color = Color.new(cr, cg, cb, ca)
|
|
||||||
else
|
|
||||||
foGraphic.ox = oldfo[0] - ((i.bgX - oldfo[0]) * fraction) if i.bgX
|
|
||||||
foGraphic.oy = oldfo[1] - ((i.bgY - oldfo[1]) * fraction) if i.bgY
|
|
||||||
foGraphic.opacity = oldfo[2] + ((i.opacity - oldfo[2]) * fraction) if i.opacity
|
|
||||||
cr = (i.colorRed) ? oldfo[3].red + ((i.colorRed - oldfo[3].red) * fraction) : oldfo[3].red
|
|
||||||
cg = (i.colorGreen) ? oldfo[3].green + ((i.colorGreen - oldfo[3].green) * fraction) : oldfo[3].green
|
|
||||||
cb = (i.colorBlue) ? oldfo[3].blue + ((i.colorBlue - oldfo[3].blue) * fraction) : oldfo[3].blue
|
|
||||||
ca = (i.colorAlpha) ? oldfo[3].alpha + ((i.colorAlpha - oldfo[3].alpha) * fraction) : oldfo[3].alpha
|
|
||||||
foGraphic.color = Color.new(cr, cg, cb, ca)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user