Finished FPS agnosticism, removed particle engine

This commit is contained in:
Maruno17
2023-06-03 21:55:02 +01:00
parent 68de25562a
commit 1901675e33
39 changed files with 652 additions and 1504 deletions

View File

@@ -491,6 +491,7 @@ class MapScreenScene
end
end
end
# TODO: FPS. Scroll speed with arrow keys. Can probably leave this alone.
if Input.press?(Input::UP)
@mapsprites.each do |i|
i[1].y += 4 if i

View File

@@ -77,7 +77,7 @@ module BattleAnimationEditor
menuwindow.update
hit = menuwindow.hittest
menuwindow.index = hit if hit >= 0
if Input.trigger?(Input::MOUSELEFT) || Input.trigger?(Input::MOUSERIGHT) # Left or right button
if Input.trigger?(Input::MOUSELEFT) || Input.trigger?(Input::MOUSERIGHT) # Left or right button
menuwindow.dispose
return hit
end
@@ -86,7 +86,7 @@ module BattleAnimationEditor
menuwindow.dispose
return hit
end
if Input.trigger?(Input::BACK) # Escape
if Input.trigger?(Input::BACK) # Escape
break
end
end
@@ -198,7 +198,7 @@ module BattleAnimationEditor
right.x += self.x
right.y += self.y
swatchrects = []
repeattime = Input.time?(Input::MOUSELEFT) / 1000
repeattime = Input.time?(Input::MOUSELEFT)
NUMFRAMES.times do |i|
swatchrects.push(Rect.new(arrowwidth + (i * 96) + self.x, self.y, 96, 96))
end
@@ -211,7 +211,7 @@ module BattleAnimationEditor
end
# Left arrow
if left.contains?(mousepos[0], mousepos[1])
if repeattime > 750
if repeattime > 0.75
@start -= 3
else
@start -= 1
@@ -221,7 +221,7 @@ module BattleAnimationEditor
end
# Right arrow
if right.contains?(mousepos[0], mousepos[1])
if repeattime > 750
if repeattime > 0.75
@start += 3
else
@start += 1
@@ -903,7 +903,7 @@ module BattleAnimationEditor
end
updateInput
# @testscreen.update
# self.bitmap=@testscreen.bitmap
# self.bitmap = @testscreen.bitmap
if @currentframe < @animation.length
PBAnimation::MAX_SPRITES.times do |i|
next if !@dirty[i]

View File

@@ -237,12 +237,14 @@ module BattleAnimationEditor
def text=(value)
@text = value
@cursor_shown = true
self.invalidate
end
def initialize(label, text)
super(label)
@frame = 0
@cursor_timer_start = System.uptime
@cursor_shown = true
@label = label
@text = text
@cursor = text.scan(/./m).length
@@ -254,7 +256,8 @@ module BattleAnimationEditor
@text = ""
chars.each { |char| @text += char }
@cursor += 1
@frame = 0
@cursor_timer_start = System.uptime
@cursor_shown = true
self.changed = true
self.invalidate
end
@@ -265,21 +268,25 @@ module BattleAnimationEditor
@text = ""
chars.each { |char| @text += char }
@cursor -= 1
@frame = 0
@cursor_timer_start = System.uptime
@cursor_shown = true
self.changed = true
self.invalidate
end
def update
@frame += 1
@frame %= 20
cursor_to_show = ((System.uptime - @cursor_timer_start) / 0.35).to_i % 2 == 0
self.changed = false
self.invalidate if (@frame % 10) == 0
if cursor_to_show != @cursor_shown
@cursor_shown = cursor_to_show
self.invalidate
end
# Moving cursor
if Input.triggerex?(:LEFT) || Input.repeatex?(:LEFT)
if @cursor > 0
@cursor -= 1
@frame = 0
@cursor_timer_start = System.uptime
@cursor_shown = true
self.invalidate
end
return
@@ -287,7 +294,8 @@ module BattleAnimationEditor
if Input.triggerex?(:RIGHT) || Input.repeatex?(:RIGHT)
if @cursor < self.text.scan(/./m).length
@cursor += 1
@frame = 0
@cursor_timer_start = System.uptime
@cursor_shown = true
self.invalidate
end
return
@@ -344,13 +352,13 @@ module BattleAnimationEditor
# Draw text
shadowtext(bitmap, x, y, textwidth + 4, 32, c)
# Draw cursor if necessary
if ((@frame / 10) & 1) == 0 && i == @cursor
if i == @cursor && @cursor_shown
bitmap.fill_rect(x, y + 4, 2, 24, Color.new(120, 120, 120))
end
# Add x to drawn text width
x += textwidth
end
if ((@frame / 10) & 1) == 0 && textscan.length == @cursor
if textscan.length == @cursor && @cursor_shown
bitmap.fill_rect(x, y + 4, 2, 24, Color.new(120, 120, 120))
end
# Draw outline
@@ -419,12 +427,12 @@ module BattleAnimationEditor
left = toAbsoluteRect(@leftarrow)
right = toAbsoluteRect(@rightarrow)
oldvalue = self.curvalue
repeattime = Input.time?(Input::MOUSELEFT) / 1000
repeattime = Input.time?(Input::MOUSELEFT)
# Left arrow
if left.contains?(mousepos[0], mousepos[1])
if repeattime > 3000
if repeattime > 3.0
self.curvalue -= 10
elsif repeattime > 1500
elsif repeattime > 1.5
self.curvalue -= 5
else
self.curvalue -= 1
@@ -435,9 +443,9 @@ module BattleAnimationEditor
end
# Right arrow
if right.contains?(mousepos[0], mousepos[1])
if repeattime > 3000
if repeattime > 3.0
self.curvalue += 10
elsif repeattime > 1500
elsif repeattime > 1.5
self.curvalue += 5
else
self.curvalue += 1
@@ -671,12 +679,12 @@ module BattleAnimationEditor
left = toAbsoluteRect(@leftarrow)
right = toAbsoluteRect(@rightarrow)
oldvalue = self.curvalue
repeattime = Input.time?(Input::MOUSELEFT) / 1000
repeattime = Input.time?(Input::MOUSELEFT)
# Left arrow
if left.contains?(mousepos[0], mousepos[1])
if repeattime > 3000
if repeattime > 3.0
self.curvalue -= 10
elsif repeattime > 1500
elsif repeattime > 1.5
self.curvalue -= 5
else
self.curvalue -= 1
@@ -686,9 +694,9 @@ module BattleAnimationEditor
end
# Right arrow
if right.contains?(mousepos[0], mousepos[1])
if repeattime > 3000
if repeattime > 3.0
self.curvalue += 10
elsif repeattime > 1500
elsif repeattime > 1.5
self.curvalue += 5
else
self.curvalue += 1

View File

@@ -241,7 +241,7 @@ module BattleAnimationEditor
Graphics.update
Input.update
sliderwin2.update
if sliderwin2.changed?(0) # Number of frames
if sliderwin2.changed?(0) # Number of frames
if path
path = path.smoothPointPath(sliderwin2.value(0), false)
i = 0
@@ -341,7 +341,7 @@ module BattleAnimationEditor
points.clear
if showline
path = curveToPointPath(curve, sliderwin2.value(0))
# File.open("pointpath.txt","wb") { |f| f.write(path.inspect) }
# File.open("pointpath.txt", "wb") { |f| f.write(path.inspect) }
path.each do |point|
points.push(PointSprite.new(point[0], point[1], canvas.viewport))
end
@@ -400,11 +400,11 @@ module BattleAnimationEditor
path.each do |point|
points.push(PointSprite.new(point[0], point[1], canvas.viewport))
end
# File.open("pointpath.txt","wb") { |f| f.write(path.inspect) }
# File.open("pointpath.txt", "wb") { |f| f.write(path.inspect) }
sliderwin2.visible = true
next
elsif sliderwin2.changed?(okbutton) && path
# File.open("pointpath.txt","wb") { |f| f.write(path.inspect) }
# File.open("pointpath.txt", "wb") { |f| f.write(path.inspect) }
neededsize = canvas.currentframe + sliderwin2.value(0)
if neededsize > canvas.animation.length
canvas.animation.resize(neededsize)

View File

@@ -157,15 +157,15 @@ module BattleAnimationEditor
_INTL("Rename"),
_INTL("Delete")], -1)
case cmd2
when 0 # Load Animation
when 0 # Load Animation
canvas.loadAnimation(animations[cmdwin.index])
animwin.animbitmap = canvas.animbitmap
animations.selected = cmdwin.index
break
when 1 # Rename
when 1 # Rename
pbAnimName(animations[cmdwin.index], cmdwin)
cmdwin.refresh
when 2 # Delete
when 2 # Delete
if pbConfirmMessage(_INTL("Are you sure you want to delete this animation?"))
animations[cmdwin.index] = PBAnimation.new
cmdwin.commands[cmdwin.index] = _INTL("{1} {2}", cmdwin.index, animations[cmdwin.index].name)
@@ -409,13 +409,13 @@ module BattleAnimationEditor
cmdwin.index != cmdEditBG &&
cmdwin.index != cmdNewFO &&
cmdwin.index != cmdEditFO
if framewindow.changed?(1) # Set Frame
if framewindow.changed?(1) # Set Frame
canvas.animation.timing[cmdwin.index].frame = framewindow.value(0) - 1
cmdwin.commands[cmdwin.index] = canvas.animation.timing[cmdwin.index].to_s
cmdwin.refresh
next
end
if framewindow.changed?(2) # Delete Timing
if framewindow.changed?(2) # Delete Timing
canvas.animation.timing.delete_at(cmdwin.index)
cmdwin.commands.delete_at(cmdwin.index)
cmdNewSound -= 1 if cmdNewSound >= 0
@@ -429,35 +429,35 @@ module BattleAnimationEditor
end
if Input.trigger?(Input::USE)
redrawcmds = false
if cmdwin.index == cmdNewSound # Add new sound
if cmdwin.index == cmdNewSound # Add new sound
newaudio = PBAnimTiming.new(0)
if pbSelectSE(canvas, newaudio)
newaudio.frame = framewindow.value(0) - 1
canvas.animation.timing.push(newaudio)
redrawcmds = true
end
elsif cmdwin.index == cmdNewBG # Add new background graphic set
elsif cmdwin.index == cmdNewBG # Add new background graphic set
newtiming = PBAnimTiming.new(1)
if pbSelectBG(canvas, newtiming)
newtiming.frame = framewindow.value(0) - 1
canvas.animation.timing.push(newtiming)
redrawcmds = true
end
elsif cmdwin.index == cmdEditBG # Add new background edit
elsif cmdwin.index == cmdEditBG # Add new background edit
newtiming = PBAnimTiming.new(2)
if pbEditBG(canvas, newtiming)
newtiming.frame = framewindow.value(0) - 1
canvas.animation.timing.push(newtiming)
redrawcmds = true
end
elsif cmdwin.index == cmdNewFO # Add new foreground graphic set
elsif cmdwin.index == cmdNewFO # Add new foreground graphic set
newtiming = PBAnimTiming.new(3)
if pbSelectBG(canvas, newtiming)
newtiming.frame = framewindow.value(0) - 1
canvas.animation.timing.push(newtiming)
redrawcmds = true
end
elsif cmdwin.index == cmdEditFO # Add new foreground edit
elsif cmdwin.index == cmdEditFO # Add new foreground edit
newtiming = PBAnimTiming.new(4)
if pbEditBG(canvas, newtiming)
newtiming.frame = framewindow.value(0) - 1
@@ -596,7 +596,7 @@ module BattleAnimationEditor
Input.update
cmdwin.update
maxsizewindow.update
if maxsizewindow.changed?(8) # OK
if maxsizewindow.changed?(8) # OK
timing.name = File.basename(filename, ".*")
timing.bgX = maxsizewindow.value(1)
timing.bgY = maxsizewindow.value(2)
@@ -647,7 +647,7 @@ module BattleAnimationEditor
Graphics.update
Input.update
maxsizewindow.update
if maxsizewindow.changed?(8) # OK
if maxsizewindow.changed?(8) # OK
if maxsizewindow.controls[1].checked ||
maxsizewindow.controls[2].checked ||
maxsizewindow.controls[3].checked ||
@@ -694,7 +694,7 @@ module BattleAnimationEditor
endvalue = sliderwin2.value(1) - 1
dstvalue = sliderwin2.value(2) - 1
length = (endvalue - startvalue) + 1
if length > 0 # Ensure correct overlap handling
if length > 0 # Ensure correct overlap handling
if startvalue < dstvalue
startvalue += length
dstvalue += length
@@ -1037,7 +1037,7 @@ module BattleAnimationEditor
sliderwin.invalidate
end
next
elsif Input.trigger?(Input::MOUSERIGHT) # Right mouse button
elsif Input.trigger?(Input::MOUSERIGHT) # Right mouse button
mousepos = Mouse.getMousePos
mousepos = [0, 0] if !mousepos
commands = [
@@ -1051,29 +1051,29 @@ module BattleAnimationEditor
]
hit = pbTrackPopupMenu(commands)
case hit
when 0 # Properties
when 0 # Properties
if canvas.currentCel
pbCellProperties(canvas)
canvas.invalidateCel(canvas.currentcel)
end
when 1 # Cut
when 1 # Cut
if canvas.currentCel
Clipboard.setData(canvas.currentCel, "PBAnimCel")
canvas.deleteCel(canvas.currentcel)
end
when 2 # Copy
when 2 # Copy
Clipboard.setData(canvas.currentCel, "PBAnimCel") if canvas.currentCel
when 3 # Paste
when 3 # Paste
canvas.pasteCel(mousepos[0], mousepos[1])
when 4 # Delete
when 4 # Delete
canvas.deleteCel(canvas.currentcel)
when 5 # Renumber
when 5 # Renumber
if canvas.currentcel && canvas.currentcel >= 2
cel1 = canvas.currentcel
cel2 = pbChooseNum(cel1)
canvas.swapCels(cel1, cel2) if cel2 >= 2 && cel1 != cel2
end
when 6 # Extrapolate Path
when 6 # Extrapolate Path
if canvas.currentCel
pbDefinePath(canvas)
sliderwin.invalidate
@@ -1081,10 +1081,10 @@ module BattleAnimationEditor
end
next
end
if sliderwin.changed?(0) # Current frame changed
if sliderwin.changed?(0) # Current frame changed
canvas.currentframe = sliderwin.value(0) - 1
end
if sliderwin.changed?(1) # Change frame count
if sliderwin.changed?(1) # Change frame count
pbChangeMaximum(canvas)
if canvas.currentframe >= canvas.animation.length
canvas.currentframe = canvas.animation.length - 1
@@ -1092,12 +1092,12 @@ module BattleAnimationEditor
end
sliderwin.refresh
end
if sliderwin.changed?(2) # Set Animation Sheet
if sliderwin.changed?(2) # Set Animation Sheet
pbSelectAnim(canvas, animwin)
animwin.refresh
sliderwin.refresh
end
if sliderwin.changed?(3) # List of Animations
if sliderwin.changed?(3) # List of Animations
pbAnimList(animation, canvas, animwin)
sliderwin.controls[0].curvalue = canvas.currentframe + 1
bottomwindow.refresh
@@ -1107,7 +1107,7 @@ module BattleAnimationEditor
pbTimingList(canvas) if sidewin.changed?(0)
if sidewin.changed?(1)
positions = [_INTL("User"), _INTL("Target"), _INTL("User and target"), _INTL("Screen")]
indexes = [2, 1, 3, 4] # Keeping backwards compatibility
indexes = [2, 1, 3, 4] # Keeping backwards compatibility
positions.length.times do |i|
selected = "[ ]"
selected = "[X]" if animation[animation.selected].position == indexes[i]

View File

@@ -1030,12 +1030,14 @@ MenuHandlers.add(:debug_menu, :toggle_snag_machine, {
}
})
MenuHandlers.add(:debug_menu, :relic_stone, {
"name" => _INTL("Use Relic Stone"),
MenuHandlers.add(:debug_menu, :toggle_purify_chamber_access, {
"name" => _INTL("Toggle Purify Chamber Access"),
"parent" => :shadow_pokemon_menu,
"description" => _INTL("Choose a Shadow Pokémon to show to the Relic Stone for purification."),
"description" => _INTL("Toggle access to the Purify Chamber via the PC."),
"effect" => proc {
pbRelicStone
$player.seen_purify_chamber = !$player.seen_purify_chamber
pbMessage(_INTL("The Purify Chamber is accessible.")) if $player.seen_purify_chamber
pbMessage(_INTL("The Purify Chamber is not accessible.")) if !$player.seen_purify_chamber
}
})
@@ -1048,6 +1050,15 @@ MenuHandlers.add(:debug_menu, :purify_chamber, {
}
})
MenuHandlers.add(:debug_menu, :relic_stone, {
"name" => _INTL("Use Relic Stone"),
"parent" => :shadow_pokemon_menu,
"description" => _INTL("Choose a Shadow Pokémon to show to the Relic Stone for purification."),
"effect" => proc {
pbRelicStone
}
})
#===============================================================================
# PBS file editors
#===============================================================================

View File

@@ -185,14 +185,14 @@ def pbDebugVariables(mode)
end
current_id = right_window.index + 1
case mode
when 0 # Switches
when 0 # Switches
if Input.trigger?(Input::USE)
pbPlayDecisionSE
$game_switches[current_id] = !$game_switches[current_id]
right_window.refresh
$game_map.need_refresh = true
end
when 1 # Variables
when 1 # Variables
if Input.repeat?(Input::LEFT)
pbDebugSetVariable(current_id, -1)
right_window.refresh