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

@@ -35,11 +35,11 @@ def pbDrawGauge(bitmap, rect, color, value, maxValue)
end
end
def calcPoint(x, y, distance, angle) # angle in degrees
angle -= (angle / 360.0).floor * 360 # normalize
angle = (angle / 360.0) * (2 * Math::PI) # convert to radians
angle = -angle % (2 * Math::PI) # normalize radians
point = [(Math.cos(angle) * distance), (Math.sin(angle) * distance)]
def calcPoint(x, y, distance, angle) # angle in degrees
angle -= (angle / 360.0).floor * 360 # normalize
angle = (angle / 360.0) * (2 * Math::PI) # convert to radians
angle = -angle % (2 * Math::PI) # normalize radians
point = [distance * Math.cos(angle), distance * Math.sin(angle)]
point[0] += x
point[1] += y
return point
@@ -670,6 +670,9 @@ end
#
#===============================================================================
class DirectFlowDiagram
# Distance travelled by a dot in 1 second.
DOT_SPEED = 80
def initialize(viewport = nil)
@points = []
@angles = []
@@ -681,21 +684,25 @@ class DirectFlowDiagram
@distance = 96
end
def dispose
@points.each { |point| point.dispose }
end
# 0=none, 1=weak, 2=strong
def setFlowStrength(strength)
@strength = strength
end
def visible=(value)
@points.each do |point|
point.visible = value
end
@points.each { |point| point.visible = value }
end
def dispose
@points.each do |point|
point.dispose
end
def color=(value)
@points.each { |point| point.color = value }
end
def setAngle(angle1)
@angle = angle1 - ((angle1 / 360).floor * 360)
end
def ensurePoint(j)
@@ -725,18 +732,9 @@ class DirectFlowDiagram
end
i += (@strength == 2) ? 16 : 32
end
@offset += (@strength == 2) ? 3 : 2
@offset %= @distance
end
def color=(value)
@points.each do |point|
point.color = value
end
end
def setAngle(angle1)
@angle = angle1 - ((angle1 / 360).floor * 360)
offset_delta = System.uptime * DOT_SPEED
offset_delta *= 1.5 if @strength == 2
@offset = offset_delta % @distance
end
end
@@ -744,6 +742,9 @@ end
#
#===============================================================================
class FlowDiagram
# Distance travelled by a dot in 1 second.
DOT_SPEED = 80
def initialize(viewport = nil)
@points = []
@angles = []
@@ -755,21 +756,21 @@ class FlowDiagram
@distance = 96
end
# 0=none, 1=weak, 2=strong
def setFlowStrength(strength)
@strength = strength
def dispose
@points.each { |point| point.dispose }
end
def visible=(value)
@points.each do |point|
point.visible = value
end
@points.each { |point| point.visible = value }
end
def dispose
@points.each do |point|
point.dispose
end
def color=(value)
@points.each { |point| point.color = value }
end
# 0=none, 1=weak, 2=strong
def setFlowStrength(strength)
@strength = strength
end
def ensurePoint(j)
@@ -781,6 +782,15 @@ class FlowDiagram
@points[j].visible = (@strength != 0)
end
def setRange(angle1, angle2)
@startAngle = angle1 - ((angle1 / 360).floor * 360)
@endAngle = angle2 - ((angle2 / 360).floor * 360)
if @startAngle == @endAngle && angle1 != angle2
@startAngle = 0
@endAngle = 359.99
end
end
def withinRange(angle, startAngle, endAngle)
if startAngle > endAngle
return (angle >= startAngle || angle <= endAngle) &&
@@ -808,23 +818,9 @@ class FlowDiagram
end
i += (@strength == 2) ? 10 : 20
end
@offset -= (@strength == 2) ? 3 : 2
@offset %= (360 * 6)
end
def color=(value)
@points.each do |point|
point.color = value
end
end
def setRange(angle1, angle2)
@startAngle = angle1 - ((angle1 / 360).floor * 360)
@endAngle = angle2 - ((angle2 / 360).floor * 360)
if @startAngle == @endAngle && angle1 != angle2
@startAngle = 0
@endAngle = 359.99
end
offset_delta = -System.uptime * DOT_SPEED
offset_delta *= 1.5 if @strength == 2
@offset = offset_delta % (360 * 6)
end
end
@@ -870,7 +866,7 @@ class PurifyChamberSetView < Sprite
setcount.times do |i|
@flows[i] = FlowDiagram.new(self.viewport) if !@flows[i]
angle = 360 - (i * 360 / setcount)
angle += 90 # start at 12 not 3 o'clock
angle += 90 # start at 12 not 3 o'clock
endAngle = angle - (360 / setcount)
@flows[i].setRange(endAngle, angle)
@flows[i].setFlowStrength(@chamber[@set].affinity(i))
@@ -913,7 +909,7 @@ class PurifyChamberSetView < Sprite
if pos.nil?
@cursor = 0
else
pos -= (pos / points).floor * points # modulus
pos -= (pos / points).floor * points # modulus
pos *= 2 if @chamber.setCount(@set) == PurifyChamber::SETSIZE
@cursor = pos + 1
end