Skip to content

Commit

Permalink
Fixed crash upon soft resetting
Browse files Browse the repository at this point in the history
  • Loading branch information
Maruno17 committed Jul 31, 2023
1 parent bd70166 commit ea7b5d5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 27 deletions.
30 changes: 9 additions & 21 deletions Data/Scripts/001_Technical/006_RPG_Sprite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -340,32 +340,20 @@ def update
end

#===============================================================================
# A modification to class Sprite that allows its coordinates to be floats rather
# than integers.
# A version of class Sprite that allows its coordinates to be floats rather than
# integers.
#===============================================================================
class Sprite
attr_accessor :float

alias :__float__x :x
alias :__float__y :y
alias :__float__x_equals :x=
alias :__float__y_equals :y=

def x
return (@float) ? @real_x : __float__x
end

def y
return (@float) ? @real_y : __float__y
end
class FloatSprite < Sprite
def x; return @float_x; end
def y; return @float_y; end

def x=(value)
@real_x = value if @float
__float__x_equals(value)
@float_x = value
super
end

def y=(value)
@real_y = value if @float
__float__y_equals(value)
@float_y = value
super
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,7 @@ def ensureSprites
if @sprites.length < MAX_SPRITES && @weatherTypes[@type] && @weatherTypes[@type][1].length > 0
MAX_SPRITES.times do |i|
if !@sprites[i]
sprite = Sprite.new(@origViewport)
sprite.float = true
sprite = FloatSprite.new(@origViewport)
sprite.z = 1000
sprite.ox = @ox + @ox_offset
sprite.oy = @oy + @oy_offset
Expand All @@ -180,8 +179,7 @@ def ensureSprites
@weatherTypes[@target_type][1].length > 0
MAX_SPRITES.times do |i|
if !@new_sprites[i]
sprite = Sprite.new(@origViewport)
sprite.float = true
sprite = FloatSprite.new(@origViewport)
sprite.z = 1000
sprite.ox = @ox + @ox_offset
sprite.oy = @oy + @oy_offset
Expand All @@ -198,8 +196,7 @@ def ensureTiles
return if @tiles.length >= @tiles_wide * @tiles_tall
(@tiles_wide * @tiles_tall).times do |i|
if !@tiles[i]
sprite = Sprite.new(@origViewport)
sprite.float = true
sprite = FloatSprite.new(@origViewport)
sprite.z = 1000
sprite.ox = @ox + @ox_offset
sprite.oy = @oy + @oy_offset
Expand Down

0 comments on commit ea7b5d5

Please sign in to comment.