Skip to content

Commit

Permalink
Fix crashes when trying to save HoD player sprites
Browse files Browse the repository at this point in the history
  • Loading branch information
LagoLunatic committed Aug 30, 2021
1 parent 6c21e36 commit 99e7119
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion dsvlib/sprite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ def read_from_rom_by_pointer(sprite_pointer)
else
animation_data = fs.read(animation_pointer, Animation.data_size)
animation = Animation.new.from_data(animation_data, animation_pointer)
@animations_by_offset[animation_pointer] = animation
end
@animations_by_offset[animation_pointer] = animation
end

@animations << animation
Expand Down Expand Up @@ -427,6 +427,7 @@ def write_to_rom_by_pointer
if @animations.length > 0
if SYSTEM == :gba
@animations.each do |anim|
next if anim.nil?
anim_offset = fs.get_free_space(Animation.data_size + anim.frame_delays.length*FrameDelay.data_size, overlay_id)
@animations_by_offset[anim_offset] = anim
offset = anim_offset+Animation.data_size
Expand All @@ -441,6 +442,7 @@ def write_to_rom_by_pointer
anim_list_offset = fs.get_free_space(@animations.length*Animation.data_size, overlay_id)
offset = anim_list_offset
@animations.each do |anim|
next if anim.nil?
@animations_by_offset[offset] = anim
offset += Animation.data_size
end
Expand Down Expand Up @@ -479,6 +481,7 @@ def write_to_rom_by_pointer
offset = @animation_list_offset
@number_of_animations = @animations.length
@animations.each do |animation|
next if animation.nil?
animation.number_of_frames = animation.frame_delays.length

if animation.frame_delays.length == 0
Expand Down

0 comments on commit 99e7119

Please sign in to comment.