Anim Editor: bug fixes

This commit is contained in:
Maruno17
2024-04-21 23:08:48 +01:00
parent 032ad25adc
commit 23a8c552d6
5 changed files with 224 additions and 33 deletions

View File

@@ -265,6 +265,7 @@ class AnimationEditor
end
def save
AnimationEditor::ParticleDataHelper.optimize_all_particles(@anim[:particles])
GameData::Animation.register(@anim, @anim_id)
Compiler.write_battle_animation_file(@anim[:pbs_path])
if @anim[:pbs_path] != @pbs_path
@@ -967,7 +968,7 @@ class AnimationEditor
break
end
end
update_input
update_input if !@captured
end
#-----------------------------------------------------------------------------

View File

@@ -229,6 +229,7 @@ module AnimationEditor::ParticleDataHelper
set_now = nil
move_ending_now = nil
move_starting_now = nil
set_at_end_of_move_starting_now = nil
particle[property].each do |cmd|
if cmd[1] == 0
set_now = cmd if cmd[0] == frame
@@ -237,6 +238,11 @@ module AnimationEditor::ParticleDataHelper
move_ending_now = cmd if cmd[0] + cmd[1] == frame
end
end
if move_starting_now
particle[property].each do |cmd|
set_at_end_of_move_starting_now = cmd if cmd[1] == 0 && cmd[0] == move_starting_now[0] + move_starting_now[1]
end
end
# Delete SetXYZ if it is at frame
particle[property].delete(set_now) if set_now
# Edit/delete MoveXYZ commands starting/ending at frame
@@ -247,14 +253,27 @@ module AnimationEditor::ParticleDataHelper
elsif move_ending_now # Delete MoveXYZ ending now
particle[property].delete(move_ending_now)
elsif move_starting_now && (full_delete || !set_now) # Turn into SetXYZ at its end point
move_starting_now[0] += move_starting_now[1]
move_starting_now[1] = 0
move_starting_now[3] = nil
move_starting_now.compact!
if set_at_end_of_move_starting_now
particle[property].delete(move_starting_now)
else
move_starting_now[0] += move_starting_now[1]
move_starting_now[1] = 0
move_starting_now[3] = nil
move_starting_now.compact!
end
end
return (particle[property].empty?) ? nil : particle[property]
end
def optimize_all_particles(particles)
particles.each do |particle|
particle.each_pair do |key, cmds|
next if !cmds.is_a?(Array) || cmds.empty?
particle[key] = optimize_commands(particle, key)
end
end
end
# Removes commands for the particle's given property if they don't make a
# difference. Returns the resulting set of commands.
def optimize_commands(particle, property)
@@ -281,7 +300,6 @@ module AnimationEditor::ParticleDataHelper
first_non_visible_cmd = -1
particle.each_pair do |prop, value|
next if !value.is_a?(Array) || value.empty?
next if prop == property && value[0][0] == frame
first_cmd = value[0][0] if first_cmd < 0 || first_cmd > value[0][0]
next if prop == :visible
first_non_visible_cmd = value[0][0] if first_non_visible_cmd < 0 || first_non_visible_cmd > value[0][0]

View File

@@ -2,15 +2,19 @@
#
#===============================================================================
class Battle::Scene
alias __newanims__pbInitSprites pbInitSprites unless method_defined?(:__newanims__pbInitSprites)
def pbInitSprites
__newanims__pbInitSprites
alias __newanims__pbCreateBackdropSprites pbCreateBackdropSprites unless method_defined?(:__newanims__pbCreateBackdropSprites)
def pbCreateBackdropSprites
__newanims__pbCreateBackdropSprites
["battle_bg", "battle_bg2"].each { |spr| @sprites[spr].z = -200 }
2.times do |side|
@sprites["base_#{side}"].z = -199
end
@sprites["cmdBar_bg"].z += 9999
end
alias __newanims__pbInitSprites pbInitSprites unless method_defined?(:__newanims__pbInitSprites)
def pbInitSprites
__newanims__pbInitSprites
@sprites["messageBox"].z += 9999
@sprites["messageWindow"].z += 9999
@sprites["commandWindow"].z += 9999
@@ -27,7 +31,6 @@ class Battle::Scene
@battle.battlers.each_with_index do |b, i|
@sprites["dataBox_#{i}"].z += 9999 if b
end
@battle.player.each_with_index do |p, i|
@sprites["player_#{i + 1}"].z = 1500 + (i * 100)
end
@@ -36,7 +39,6 @@ class Battle::Scene
@sprites["trainer_#{i + 1}"].z = 500 - (i * 100)
end
end
end
end

View File

@@ -1,22 +0,0 @@
# See the documentation on the wiki to learn how to edit this file.
#-------------------------------
[Move,TACKLE]
Name = Example anim
<User>
SetX = 0,0
SetY = 0,0
<Target>
SetX = 0,0
SetY = 0,0
<Particle 2>
Graphic = Examples/Tackle_B
Focus = Target
SetX = 2,0
SetY = 2,3
SetZ = 2,27
SetOpacity = 2,150
SetOpacity = 3,255
SetOpacity = 8,150
SetOpacity = 9,100
<SE>
Play = 0,Blow1,80

View File

@@ -0,0 +1,192 @@
# See the documentation on the wiki to learn how to edit this file.
#-------------------------------
[Move,TACKLE]
Name = Essentials
<User>
FoeInvertX = true
FoeInvertY = true
MoveX = 0,1,28
MoveY = 0,1,-16
MoveX = 3,1,0
MoveY = 3,1,0
<Target>
FoeInvertX = true
MoveX = 4,1,-2
MoveX = 5,2,2
MoveX = 7,2,-2
MoveX = 9,2,2
MoveX = 11,1,0
<Hit 1>
Graphic = Normal/Tackle hit 1
Focus = Target
SetZ = 4,10
SetZoomX = 4,75
SetZoomY = 4,75
SetColorRed = 4,248
SetColorGreen = 4,248
SetColorBlue = 4,192
SetColorAlpha = 4,255
MoveZoomX = 4,1,100
MoveZoomY = 4,1,100
SetVisible = 5,false
<Hit 2>
Graphic = Normal/Tackle hit 2
Focus = Target
SetZ = 5,10
SetZoomX = 5,60
SetZoomY = 5,60
SetColorRed = 5,248
SetColorGreen = 5,192
SetColorAlpha = 5,255
MoveZoomX = 5,4,100
MoveZoomY = 5,4,100
MoveOpacity = 5,4,0
SetVisible = 9,false
<Spark 1>
Graphic = Normal/Tackle spark
Focus = Target
SetX = 4,-11
SetY = 4,-17
SetZ = 4,5
SetZoomX = 4,50
SetZoomY = 4,50
SetOpacity = 4,0
SetColorRed = 4,248
SetColorGreen = 4,248
SetColorBlue = 4,128
SetColorAlpha = 4,255
MoveOpacity = 4,1,255
MoveX = 4,13,-102
MoveY = 4,13,-68,EaseOut
MoveZoomX = 8,9,0
MoveZoomY = 8,9,0
MoveOpacity = 8,9,0
MoveColorGreen = 8,9,96,EaseOut
MoveColorBlue = 8,9,32,EaseOut
<Spark 2>
Graphic = Normal/Tackle spark
Focus = Target
SetX = 5,-3
SetY = 5,-24
SetZ = 5,5
SetZoomX = 5,50
SetZoomY = 5,50
SetOpacity = 5,0
SetColorRed = 5,248
SetColorGreen = 5,248
SetColorBlue = 5,128
SetColorAlpha = 5,255
MoveOpacity = 5,1,255
MoveX = 5,13,-40
MoveY = 5,13,-116,EaseOut
MoveZoomX = 9,9,0
MoveZoomY = 9,9,0
MoveOpacity = 9,9,0
MoveColorGreen = 9,9,96,EaseOut
MoveColorBlue = 9,9,32,EaseOut
<Spark 3>
Graphic = Normal/Tackle spark
Focus = Target
SetX = 4,8
SetY = 4,-7
SetZ = 4,5
SetZoomX = 4,50
SetZoomY = 4,50
SetOpacity = 4,0
SetColorRed = 4,248
SetColorGreen = 4,248
SetColorBlue = 4,128
SetColorAlpha = 4,255
MoveOpacity = 4,1,255
MoveX = 4,13,-1
MoveY = 4,13,-94,EaseOut
MoveZoomX = 8,9,0
MoveZoomY = 8,9,0
MoveOpacity = 8,9,0
MoveColorGreen = 8,9,96,EaseOut
MoveColorBlue = 8,9,32,EaseOut
<Spark 4>
Graphic = Normal/Tackle spark
Focus = Target
SetX = 5,7
SetY = 5,-6
SetZ = 5,5
SetZoomX = 5,50
SetZoomY = 5,50
SetOpacity = 5,0
SetColorRed = 5,248
SetColorGreen = 5,248
SetColorBlue = 5,128
SetColorAlpha = 5,255
MoveOpacity = 5,1,255
MoveX = 5,13,50
MoveY = 5,13,-106,EaseOut
MoveZoomX = 9,9,0
MoveZoomY = 9,9,0
MoveOpacity = 9,9,0
MoveColorGreen = 9,9,96,EaseOut
MoveColorBlue = 9,9,32,EaseOut
<Spark 5>
Graphic = Normal/Tackle spark
Focus = Target
SetX = 4,25
SetY = 4,-4
SetZ = 4,5
SetZoomX = 4,50
SetZoomY = 4,50
SetOpacity = 4,0
SetColorRed = 4,248
SetColorGreen = 4,248
SetColorBlue = 4,128
SetColorAlpha = 4,255
MoveOpacity = 4,1,255
MoveX = 4,13,78
MoveY = 4,13,-28,EaseOut
MoveZoomX = 8,9,0
MoveZoomY = 8,9,0
MoveOpacity = 8,9,0
MoveColorGreen = 8,9,96,EaseOut
MoveColorBlue = 8,9,32,EaseOut
<Spark 6>
Graphic = Normal/Tackle spark
Focus = Target
SetX = 4,18
SetY = 4,-9
SetZ = 4,5
SetZoomX = 4,50
SetZoomY = 4,50
SetOpacity = 4,0
SetColorRed = 4,248
SetColorGreen = 4,248
SetColorBlue = 4,128
SetColorAlpha = 4,255
MoveOpacity = 4,1,255
MoveX = 4,13,117
MoveY = 4,13,-77,EaseOut
MoveZoomX = 8,9,0
MoveZoomY = 8,9,0
MoveOpacity = 8,9,0
MoveColorGreen = 8,9,96,EaseOut
MoveColorBlue = 8,9,32,EaseOut
<Spark 7>
Graphic = Normal/Tackle spark
Focus = Target
SetX = 5,-3
SetY = 5,-5
SetZ = 5,5
SetZoomX = 5,50
SetZoomY = 5,50
SetOpacity = 5,0
SetColorRed = 5,248
SetColorGreen = 5,248
SetColorBlue = 5,128
SetColorAlpha = 5,255
MoveOpacity = 5,1,255
MoveX = 5,13,-112
MoveY = 5,13,-26,EaseOut
MoveZoomX = 9,9,0
MoveZoomY = 9,9,0
MoveOpacity = 9,9,0
MoveColorGreen = 9,9,96,EaseOut
MoveColorBlue = 9,9,32,EaseOut
<SE>