Fix Battle Animation Memory Leak

This commit is contained in:
JappaWakka 2025-03-17 17:33:50 +01:00
parent cff7dd2083
commit 5012313ca8
16 changed files with 146 additions and 139 deletions

View File

@ -2,23 +2,20 @@
Inherits BattleAnimation3D Inherits BattleAnimation3D
Public Duration As Single = 2.0F Dim FadeInSpeed As Single = 0.01F
Public FadeInSpeed As Single = 0.01F Dim FadeOutSpeed As Single = 0.01F
Public FadeOutSpeed As Single = 0.01F Dim BackgroundOpacity As Single = 0.0F
Public BackgroundOpacity As Single = 0.0F Dim Texture As Texture2D
Public Texture As Texture2D Dim DoTile As Boolean = False
Public DoTile As Boolean = False Dim AnimationWidth As Integer = -1
Public AnimationWidth As Integer = -1 Dim AfterFadeInOpacity As Single = 1.0F
Public AnimationLength As Integer = 1 Dim FadeProgress As FadeSteps = FadeSteps.FadeIn
Public AnimationSpeed As Integer = 16 Dim DurationDate As Date
Public AfterFadeInOpacity As Single = 1.0F Dim DurationWhole As Single
Public FadeProgress As FadeSteps = FadeSteps.FadeIn Dim DurationFraction As Single
Private DurationDate As Date Dim BackgroundAnimation As Animation
Private DurationWhole As Single Dim CurrentRectangle As New Rectangle(0, 0, 0, 0)
Private DurationFraction As Single Dim TextureScale As Integer = 4
Private BackgroundAnimation As Animation
Private CurrentRectangle As New Rectangle(0, 0, 0, 0)
Private TextureScale As Integer = 4
Public Enum FadeSteps As Integer Public Enum FadeSteps As Integer
FadeIn FadeIn
@ -29,13 +26,11 @@
Public Sub New(ByVal Texture As Texture2D, ByVal startDelay As Single, ByVal endDelay As Single, ByVal Duration As Single, Optional ByVal AfterFadeInOpacity As Single = 1.0F, Optional ByVal FadeInSpeed As Single = 0.125F, Optional ByVal FadeOutSpeed As Single = 0.125F, Optional ByVal DoTile As Boolean = False, Optional ByVal AnimationLength As Integer = 1, Optional ByVal AnimationSpeed As Integer = 2, Optional TextureScale As Integer = 4) Public Sub New(ByVal Texture As Texture2D, ByVal startDelay As Single, ByVal endDelay As Single, ByVal Duration As Single, Optional ByVal AfterFadeInOpacity As Single = 1.0F, Optional ByVal FadeInSpeed As Single = 0.125F, Optional ByVal FadeOutSpeed As Single = 0.125F, Optional ByVal DoTile As Boolean = False, Optional ByVal AnimationLength As Integer = 1, Optional ByVal AnimationSpeed As Integer = 2, Optional TextureScale As Integer = 4)
MyBase.New(New Vector3(0.0F), TextureManager.DefaultTexture, New Vector3(1.0F), startDelay, endDelay) MyBase.New(New Vector3(0.0F), TextureManager.DefaultTexture, New Vector3(1.0F), startDelay, endDelay)
Me.Texture = Texture Me.Texture = Texture
Me.Duration = Duration
Me.AfterFadeInOpacity = AfterFadeInOpacity Me.AfterFadeInOpacity = AfterFadeInOpacity
Me.FadeInSpeed = FadeInSpeed Me.FadeInSpeed = FadeInSpeed
Me.FadeOutSpeed = FadeOutSpeed Me.FadeOutSpeed = FadeOutSpeed
Me.DoTile = DoTile Me.DoTile = DoTile
Me.AnimationWidth = CInt(Texture.Width / AnimationLength) Me.AnimationWidth = CInt(Texture.Width / AnimationLength)
Me.AnimationLength = AnimationLength
DurationWhole = CSng(Math.Truncate(CDbl(Duration / 6.0F))) DurationWhole = CSng(Math.Truncate(CDbl(Duration / 6.0F)))
DurationFraction = CSng((Duration / 6.0F - DurationWhole) * 1000) DurationFraction = CSng((Duration / 6.0F - DurationWhole) * 1000)
Me.TextureScale = TextureScale Me.TextureScale = TextureScale

View File

@ -4,8 +4,8 @@ Public Class BACameraChangeAngle
Inherits BattleAnimation3D Inherits BattleAnimation3D
Public CameraAngleID As Integer Dim CameraAngleID As Integer
Public BV2Screen As BattleSystem.BattleScreen Dim BV2Screen As BattleSystem.BattleScreen
Public Sub New(ByRef Battlescreen As BattleSystem.BattleScreen, ByVal CameraAngleID As Integer, ByVal startDelay As Single, ByVal endDelay As Single) Public Sub New(ByRef Battlescreen As BattleSystem.BattleScreen, ByVal CameraAngleID As Integer, ByVal startDelay As Single, ByVal endDelay As Single)
MyBase.New(New Vector3(0.0F), TextureManager.DefaultTexture, New Vector3(1.0F), startDelay, endDelay) MyBase.New(New Vector3(0.0F), TextureManager.DefaultTexture, New Vector3(1.0F), startDelay, endDelay)

View File

@ -2,20 +2,19 @@
Inherits BattleAnimation3D Inherits BattleAnimation3D
Public StartPosition As Vector3 Dim StartPosition As Vector3
Public ReturnToStart As Vector3 Dim ReturnToStart As Vector3
Public HalfDistance As New Vector3(0.0F) Dim HalfDistance As New Vector3(0.0F)
Public DestinationDistance As New Vector3(0.0F) Dim DestinationDistance As New Vector3(0.0F)
Public CurrentDistance As New Vector3(0.0F) Dim CurrentDistance As New Vector3(0.0F)
Public MoveSpeed As Single Dim MoveSpeed As Single
Public MoveBothWays As Boolean = True Dim MoveBothWays As Boolean = True
Public MovementCurve As Integer = 0 Dim MovementCurve As Integer = 0
Public RemoveEntityAfter As Boolean Dim Duration As TimeSpan
Public Duration As TimeSpan Dim ReadyTime As Date
Public ReadyTime As Date Dim ReadyAxis As New Vector3(0)
Public ReadyAxis As New Vector3(0) Dim InterpolationSpeed As Vector3
Public InterpolationSpeed As Vector3 Dim InterpolationDirection As Boolean = True
Public InterpolationDirection As Boolean = True
Public Enum Curves As Integer Public Enum Curves As Integer
Linear Linear
Smooth Smooth

View File

@ -2,18 +2,17 @@
Inherits BattleAnimation3D Inherits BattleAnimation3D
Public TargetEntity As Entity Dim TargetEntity As Entity
Public TransitionSpeed As Single = 0.01F Dim TransitionSpeed As Single = 0.01F
Public TransitionSpeedOut As Single = 0.01F Dim TransitionSpeedOut As Single = 0.01F
Public FadeIn As Boolean = False Dim ReturnToFromWhenDone As Boolean = False
Public ReturnToFromWhenDone As Boolean = False Dim RemoveEntityAfter As Boolean = False
Public RemoveEntityAfter As Boolean = False Dim InitialColorSet As Boolean = False
Public InitialColorSet As Boolean = False Dim IsReturning As Boolean = False
Public IsReturning As Boolean = False Dim ColorTo As Vector3 = New Vector3(1.0F, 1.0F, 1.0F)
Public ColorTo As Vector3 = New Vector3(1.0F, 1.0F, 1.0F) Dim ColorFrom As Vector3 = New Vector3(1.0F, 1.0F, 1.0F)
Public ColorFrom As Vector3 = New Vector3(1.0F, 1.0F, 1.0F)
Public Sub New(ByVal Entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal TransitionSpeedIn As Single, ByVal ReturnToFromWhenDone As Boolean, ByVal startDelay As Single, ByVal endDelay As Single, ByVal ColorTo As Vector3, Optional ByVal ColorFrom As Vector3 = Nothing, Optional TransitionSpeedOut As Single = -1) Public Sub New(ByRef Entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal TransitionSpeedIn As Single, ByVal ReturnToFromWhenDone As Boolean, ByVal startDelay As Single, ByVal endDelay As Single, ByVal ColorTo As Vector3, Optional ByVal ColorFrom As Vector3 = Nothing, Optional TransitionSpeedOut As Single = -1)
MyBase.New(New Vector3(0.0F), TextureManager.DefaultTexture, New Vector3(1.0F), startDelay, endDelay) MyBase.New(New Vector3(0.0F), TextureManager.DefaultTexture, New Vector3(1.0F), startDelay, endDelay)
Me.RemoveEntityAfter = RemoveEntityAfter Me.RemoveEntityAfter = RemoveEntityAfter
If TransitionSpeedOut = -1 Then If TransitionSpeedOut = -1 Then

View File

@ -9,7 +9,7 @@
Dim TurnTime As Single = 0.0F Dim TurnTime As Single = 0.0F
Dim TurnDelay As Single = 0.0F Dim TurnDelay As Single = 0.0F
Public Sub New(ByVal TargetEntity As NPC, ByVal TurnSteps As Integer, ByVal startDelay As Single, ByVal endDelay As Single, Optional ByVal EndFaceRotation As Integer = -1, Optional ByVal TurnSpeed As Integer = 1, Optional ByVal TurnDelay As Single = 0.25F) Public Sub New(ByRef TargetEntity As NPC, ByVal TurnSteps As Integer, ByVal startDelay As Single, ByVal endDelay As Single, Optional ByVal EndFaceRotation As Integer = -1, Optional ByVal TurnSpeed As Integer = 1, Optional ByVal TurnDelay As Single = 0.25F)
MyBase.New(New Vector3(0.0F), TextureManager.DefaultTexture, New Vector3(1.0F), startDelay, endDelay) MyBase.New(New Vector3(0.0F), TextureManager.DefaultTexture, New Vector3(1.0F), startDelay, endDelay)
If EndFaceRotation = -1 Then If EndFaceRotation = -1 Then
Me.EndFaceRotation = TargetEntity.faceRotation Me.EndFaceRotation = TargetEntity.faceRotation

View File

@ -2,21 +2,21 @@
Inherits BattleAnimation3D Inherits BattleAnimation3D
Public StartPosition As Vector3 Dim StartPosition As Vector3
Public TargetEntity As Entity Dim TargetEntity As Entity
Public Destination As Vector3 Dim Destination As Vector3
Public MoveDistance As New Vector3(0.0F) Dim MoveDistance As New Vector3(0.0F)
Public MoveSpeed As Single Dim MoveSpeed As Single
Public MoveYSpeed As Single Dim MoveYSpeed As Single
Public InterpolationSpeed As Single Dim InterpolationSpeed As Single
Public InterpolationYSpeed As Single Dim InterpolationYSpeed As Single
Public SpinX As Boolean = False Dim SpinX As Boolean = False
Public SpinZ As Boolean = False Dim SpinZ As Boolean = False
Public SpinSpeedX As Single = 0.1F Dim SpinSpeedX As Single = 0.1F
Public SpinSpeedZ As Single = 0.1F Dim SpinSpeedZ As Single = 0.1F
Public MovementCurve As Integer = 3 Dim MovementCurve As Integer = 3
Private EasedIn As Boolean = False Dim EasedIn As Boolean = False
Private EasedOut As Boolean = False Dim EasedOut As Boolean = False
Public RemoveEntityAfter As Boolean Public RemoveEntityAfter As Boolean
Dim ReadyAxis As Vector3 = New Vector3(0.0F) Dim ReadyAxis As Vector3 = New Vector3(0.0F)
Public Enum Curves As Integer Public Enum Curves As Integer

View File

@ -2,13 +2,13 @@
Inherits BattleAnimation3D Inherits BattleAnimation3D
Public TargetEntity As Entity Dim TargetEntity As Entity
Public TransitionSpeed As Single = 0.01F Dim TransitionSpeed As Single = 0.01F
Public FadeIn As Boolean = False Dim FadeIn As Boolean = False
Public EndState As Single = 0.0F Dim EndState As Single = 0.0F
Public RemoveEntityAfter As Boolean Dim RemoveEntityAfter As Boolean
Public Sub New(ByVal entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal TransitionSpeed As Single, ByVal FadeIn As Boolean, ByVal EndState As Single, ByVal startDelay As Single, ByVal endDelay As Single, Optional ByVal StartState As Single = 1.0F) Public Sub New(ByRef entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal TransitionSpeed As Single, ByVal FadeIn As Boolean, ByVal EndState As Single, ByVal startDelay As Single, ByVal endDelay As Single, Optional ByVal StartState As Single = 1.0F)
MyBase.New(New Vector3(0.0F), TextureManager.DefaultTexture, New Vector3(1.0F), startDelay, endDelay) MyBase.New(New Vector3(0.0F), TextureManager.DefaultTexture, New Vector3(1.0F), startDelay, endDelay)
Me.RemoveEntityAfter = RemoveEntityAfter Me.RemoveEntityAfter = RemoveEntityAfter
Me.EndState = EndState Me.EndState = EndState

View File

@ -2,21 +2,21 @@
Inherits BattleAnimation3D Inherits BattleAnimation3D
Public StartPosition As Vector3 Dim StartPosition As Vector3
Public ReturnToStart As Vector3 Dim ReturnToStart As Vector3
Public TargetEntity As Entity Dim TargetEntity As Entity
Public HalfDistance As New Vector3(0.0F) Dim HalfDistance As New Vector3(0.0F)
Public DestinationDistance As New Vector3(0.0F) Dim DestinationDistance As New Vector3(0.0F)
Public CurrentDistance As New Vector3(0.0F) Dim CurrentDistance As New Vector3(0.0F)
Public MoveSpeed As Single Dim MoveSpeed As Single
Public MoveBothWays As Boolean = True Dim MoveBothWays As Boolean = True
Public MovementCurve As Integer = 0 Dim MovementCurve As Integer = 0
Public RemoveEntityAfter As Boolean Dim RemoveEntityAfter As Boolean
Public Duration As TimeSpan Dim Duration As TimeSpan
Public ReadyTime As Date Dim ReadyTime As Date
Public ReadyAxis As New Vector3(0) Dim ReadyAxis As New Vector3(0)
Public InterpolationSpeed As Vector3 Dim InterpolationSpeed As Vector3
Public InterpolationDirection As Boolean = True Dim InterpolationDirection As Boolean = True
Public Enum Curves As Integer Public Enum Curves As Integer
Linear Linear
Smooth Smooth

View File

@ -11,9 +11,9 @@
Dim DoRotation As Vector3 = New Vector3(1.0F) Dim DoRotation As Vector3 = New Vector3(1.0F)
Dim AmountRotated As Vector3 = New Vector3(0.0F) Dim AmountRotated As Vector3 = New Vector3(0.0F)
Dim ReadyAxis As Vector3 = New Vector3(0.0F) Dim ReadyAxis As Vector3 = New Vector3(0.0F)
Public RemoveEntityAfter As Boolean = False Dim RemoveEntityAfter As Boolean = False
Public Sub New(ByVal Entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal RotationSpeedVector As Vector3, ByVal EndRotation As Vector3, ByVal startDelay As Single, ByVal endDelay As Single) Public Sub New(ByRef Entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal RotationSpeedVector As Vector3, ByVal EndRotation As Vector3, ByVal startDelay As Single, ByVal endDelay As Single)
MyBase.New(New Vector3(0.0F), TextureManager.DefaultTexture, New Vector3(1.0F), startDelay, endDelay) MyBase.New(New Vector3(0.0F), TextureManager.DefaultTexture, New Vector3(1.0F), startDelay, endDelay)
Me.RemoveEntityAfter = RemoveEntityAfter Me.RemoveEntityAfter = RemoveEntityAfter
Me.RotationSpeedVector = RotationSpeedVector Me.RotationSpeedVector = RotationSpeedVector
@ -24,7 +24,7 @@
Me.AnimationType = AnimationTypes.Rotation Me.AnimationType = AnimationTypes.Rotation
End Sub End Sub
Public Sub New(ByVal Entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal RotationSpeedVector As Vector3, ByVal EndRotation As Vector3, ByVal startDelay As Single, ByVal endDelay As Single, ByVal DoXRotation As Boolean, ByVal DoYRotation As Boolean, ByVal DoZRotation As Boolean) Public Sub New(ByRef Entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal RotationSpeedVector As Vector3, ByVal EndRotation As Vector3, ByVal startDelay As Single, ByVal endDelay As Single, ByVal DoXRotation As Boolean, ByVal DoYRotation As Boolean, ByVal DoZRotation As Boolean)
Me.New(Entity, RemoveEntityAfter, RotationSpeedVector, EndRotation, startDelay, endDelay) Me.New(Entity, RemoveEntityAfter, RotationSpeedVector, EndRotation, startDelay, endDelay)
If DoXRotation = False Then If DoXRotation = False Then
@ -41,7 +41,7 @@
End If End If
End Sub End Sub
Public Sub New(ByVal Entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal RotationSpeedVector As Vector3, ByVal EndRotation As Vector3, ByVal startDelay As Single, ByVal endDelay As Single, ByVal DoXRotation As Boolean, ByVal DoYRotation As Boolean, ByVal DoZRotation As Boolean, ByVal DoReturn As Boolean) Public Sub New(ByRef Entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal RotationSpeedVector As Vector3, ByVal EndRotation As Vector3, ByVal startDelay As Single, ByVal endDelay As Single, ByVal DoXRotation As Boolean, ByVal DoYRotation As Boolean, ByVal DoZRotation As Boolean, ByVal DoReturn As Boolean)
Me.New(Entity, RemoveEntityAfter, RotationSpeedVector, EndRotation, startDelay, endDelay, DoXRotation, DoYRotation, DoZRotation) Me.New(Entity, RemoveEntityAfter, RotationSpeedVector, EndRotation, startDelay, endDelay, DoXRotation, DoYRotation, DoZRotation)
Me.DoReturn = DoReturn Me.DoReturn = DoReturn

View File

@ -2,16 +2,16 @@
Inherits BattleAnimation3D Inherits BattleAnimation3D
Public Grow As Boolean = False Dim Grow As Boolean = False
Public EndSize As Vector3 Dim EndSize As Vector3
Public SizeSpeed As Single = 0.01F Dim SizeSpeed As Single = 0.01F
Public TargetEntity As Entity Dim TargetEntity As Entity
Public Anchors As String '1 = Bottom, 2 = Top, 3 = Left, 4 = Right. Combinations are possible. Dim Anchors As String '1 = Bottom, 2 = Top, 3 = Left, 4 = Right. Combinations are possible.
Public Change As New Vector3(1) Dim SpeedMultiplier As Vector3
Public RemoveEntityAfter As Boolean Dim RemoveEntityAfter As Boolean
Public Sub New(ByVal Entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal Scale As Vector3, ByVal Grow As Boolean, ByVal EndSize As Vector3, ByVal SizeSpeed As Single, ByVal startDelay As Single, ByVal endDelay As Single, ByVal Anchors As String) Public Sub New(ByRef Entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal Scale As Vector3, ByVal Grow As Boolean, ByVal EndSize As Vector3, ByVal SizeSpeed As Single, ByVal startDelay As Single, ByVal endDelay As Single, ByVal Anchors As String, Optional SpeedMultiplier As Vector3 = Nothing)
MyBase.New(New Vector3(0.0F), TextureManager.DefaultTexture, Scale, startDelay, endDelay) MyBase.New(New Vector3(0.0F), TextureManager.DefaultTexture, Scale, startDelay, endDelay)
Me.RemoveEntityAfter = RemoveEntityAfter Me.RemoveEntityAfter = RemoveEntityAfter
Me.Anchors = Anchors Me.Anchors = Anchors
@ -19,6 +19,11 @@
Me.EndSize = EndSize Me.EndSize = EndSize
Me.SizeSpeed = SizeSpeed Me.SizeSpeed = SizeSpeed
Me.TargetEntity = Entity Me.TargetEntity = Entity
If SpeedMultiplier <> Nothing Then
Me.SpeedMultiplier = SpeedMultiplier
Else
Me.SpeedMultiplier = New Vector3(1)
End If
Me.AnimationType = AnimationTypes.Size Me.AnimationType = AnimationTypes.Size
End Sub End Sub
@ -26,9 +31,9 @@
Public Overrides Sub DoActionActive() Public Overrides Sub DoActionActive()
Dim saveScale As Vector3 = TargetEntity.Scale Dim saveScale As Vector3 = TargetEntity.Scale
Dim changeX As Single = SizeSpeed * Change.X Dim changeX As Single = SizeSpeed * SpeedMultiplier.X
Dim changeY As Single = SizeSpeed * Change.Y Dim changeY As Single = SizeSpeed * SpeedMultiplier.Y
Dim changeZ As Single = SizeSpeed * Change.Z Dim changeZ As Single = SizeSpeed * SpeedMultiplier.Z
If Grow = True Then If Grow = True Then
If TargetEntity.Scale.X < Me.EndSize.X Then If TargetEntity.Scale.X < Me.EndSize.X Then
@ -102,9 +107,6 @@
End If End If
End Sub End Sub
Public Sub SetChange(ByVal changeX As Single, ByVal changeY As Single, ByVal changeZ As Single)
Me.Change = New Vector3(changeX, changeY, changeZ)
End Sub
Public Overrides Sub DoRemoveEntity() Public Overrides Sub DoRemoveEntity()
If Me.RemoveEntityAfter = True Then If Me.RemoveEntityAfter = True Then
TargetEntity.CanBeRemoved = True TargetEntity.CanBeRemoved = True

View File

@ -2,9 +2,9 @@
Inherits BattleAnimation3D Inherits BattleAnimation3D
Public TargetEntity As Entity Dim TargetEntity As Entity
Public SetPosition As Vector3 Dim SetPosition As Vector3
Public RemoveEntityAfter As Boolean Dim RemoveEntityAfter As Boolean
Public Sub New(ByRef Entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal SetPosition As Vector3, ByVal startDelay As Single, ByVal endDelay As Single) Public Sub New(ByRef Entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal SetPosition As Vector3, ByVal startDelay As Single, ByVal endDelay As Single)
MyBase.New(New Vector3(0.0F), TextureManager.DefaultTexture, New Vector3(1.0F), startDelay, endDelay) MyBase.New(New Vector3(0.0F), TextureManager.DefaultTexture, New Vector3(1.0F), startDelay, endDelay)

View File

@ -2,11 +2,11 @@
Inherits BattleAnimation3D Inherits BattleAnimation3D
Public Texture As Texture2D Dim Texture As Texture2D
Public TargetEntity As Entity Dim TargetEntity As Entity
Public RemoveEntityAfter As Boolean Dim RemoveEntityAfter As Boolean
Public Sub New(ByVal Entity As Entity, ByVal RemoveEntityAfter As Boolean, Texture As Texture2D, ByVal startDelay As Single, ByVal endDelay As Single) Public Sub New(ByRef Entity As Entity, ByVal RemoveEntityAfter As Boolean, Texture As Texture2D, ByVal startDelay As Single, ByVal endDelay As Single)
MyBase.New(New Vector3(0.0F), TextureManager.DefaultTexture, New Vector3(1.0F), startDelay, endDelay) MyBase.New(New Vector3(0.0F), TextureManager.DefaultTexture, New Vector3(1.0F), startDelay, endDelay)
Me.RemoveEntityAfter = RemoveEntityAfter Me.RemoveEntityAfter = RemoveEntityAfter
Me.TargetEntity = Entity Me.TargetEntity = Entity

View File

@ -2,10 +2,10 @@
Inherits BattleAnimation3D Inherits BattleAnimation3D
Private soundfile As String Dim soundfile As String
Private stopMusic As Boolean Dim stopMusic As Boolean
Private IsPokemon As Boolean Dim IsPokemon As Boolean
Private CrySuffix As String = "" Dim CrySuffix As String = ""
Public Sub New(ByVal sound As String, ByVal startDelay As Single, ByVal endDelay As Single, Optional ByVal stopMusic As Boolean = False, Optional ByVal IsPokemon As Boolean = False, Optional ByVal CrySuffix As String = "") Public Sub New(ByVal sound As String, ByVal startDelay As Single, ByVal endDelay As Single, Optional ByVal stopMusic As Boolean = False, Optional ByVal IsPokemon As Boolean = False, Optional ByVal CrySuffix As String = "")

View File

@ -24,14 +24,14 @@
Public Ready As Boolean = False Public Ready As Boolean = False
Public startDelay As Date Public startDelay As Date
Public endDelay As Date Public endDelay As Date
Public SpawnedEntity As Boolean = False Dim SpawnedEntity As Boolean = False
Public Started As Boolean = False Dim Started As Boolean = False
Private DelayDivide As Single = 6.0F Dim DelayDivide As Single = 6.0F
Private StartDelayWhole As Single Dim StartDelayWhole As Single
Private StartDelayFraction As Single Dim StartDelayFraction As Single
Private EndDelayWhole As Single Dim EndDelayWhole As Single
Private EndDelayFraction As Single Dim EndDelayFraction As Single
Private hasStartedEndDelay As Boolean = False Dim hasStartedEndDelay As Boolean = False
Public Sub New(ByVal Position As Vector3, ByVal Texture As Texture2D, ByVal Scale As Vector3, ByVal startDelay As Single, ByVal endDelay As Single, Optional SpawnedEntity As Boolean = False) Public Sub New(ByVal Position As Vector3, ByVal Texture As Texture2D, ByVal Scale As Vector3, ByVal startDelay As Single, ByVal endDelay As Single, Optional SpawnedEntity As Boolean = False)
MyBase.New(Position.X, Position.Y, Position.Z, "BattleAnimation", {Texture}, {0, 0}, False, 0, Scale, BaseModel.BillModel, 0, "", New Vector3(1.0F)) MyBase.New(Position.X, Position.Y, Position.Z, "BattleAnimation", {Texture}, {0, 0}, False, 0, Scale, BaseModel.BillModel, 0, "", New Vector3(1.0F))

View File

@ -1047,6 +1047,8 @@ nextIndexBackground:
World.DrawWeather(Screen.Level.World.CurrentMapWeather) World.DrawWeather(Screen.Level.World.CurrentMapWeather)
Core.SpriteBatch.Draw(BackgroundTarget, windowSize, Color.White) Core.SpriteBatch.Draw(BackgroundTarget, windowSize, Color.White)
Core.SpriteBatch.Draw(NPCTarget, windowSize, Color.White) Core.SpriteBatch.Draw(NPCTarget, windowSize, Color.White)
NPCTarget.Dispose()
BackgroundTarget.Dispose()
Else Else
SkyDome.Draw(45.0F) SkyDome.Draw(45.0F)
Level.Draw() Level.Draw()
@ -1090,6 +1092,8 @@ nextIndexForeground:
If DrawColoredScreen = True Then If DrawColoredScreen = True Then
Canvas.DrawRectangle(Core.windowSize, Me.ColorOverlay) Canvas.DrawRectangle(Core.windowSize, Me.ColorOverlay)
End If End If
ForegroundAnimationList.Clear()
BackgroundAnimationList.Clear()
End Sub End Sub
Public Overrides Sub Update() Public Overrides Sub Update()

View File

@ -5,44 +5,47 @@ Namespace BattleSystem
Public Class AnimationQueryObject Public Class AnimationQueryObject
Inherits QueryObject Inherits QueryObject
Public AnimationStarted As Boolean = False Dim AnimationStarted As Boolean = False
Public AnimationEnded As Boolean = False Dim AnimationEnded As Boolean = False
Public BattleFlipped As Boolean = Nothing Dim BattleFlipped As Boolean = Nothing
Public AnimationSequence As List(Of BattleAnimation3D) Dim AnimationSequence As List(Of BattleAnimation3D)
Public SpawnedEntities As List(Of Entity) Dim SpawnedEntities As List(Of Entity)
Public CurrentEntity As Entity Dim CurrentEntity As Entity
Public StartPosition As New Vector3(0)
Public DrawBeforeEntities As Boolean Public DrawBeforeEntities As Boolean
Dim Backgrounds As List(Of Entity)
Dim RenderObjects As List(Of Entity)
Public Overrides ReadOnly Property IsReady As Boolean Public Overrides ReadOnly Property IsReady As Boolean
Get Get
Return AnimationEnded Return AnimationEnded
End Get End Get
End Property End Property
Public Sub New(ByVal entity As Entity, ByVal BattleFlipped As Boolean, Optional DrawBeforeEntities As Boolean = False) Public Sub New(ByVal Entity As Entity, ByVal BattleFlipped As Boolean, Optional DrawBeforeEntities As Boolean = False)
MyBase.New(QueryTypes.MoveAnimation) MyBase.New(QueryTypes.MoveAnimation)
Me.AnimationSequence = New List(Of BattleAnimation3D) Me.AnimationSequence = New List(Of BattleAnimation3D)
Me.SpawnedEntities = New List(Of Entity) Me.SpawnedEntities = New List(Of Entity)
Me.DrawBeforeEntities = DrawBeforeEntities Me.DrawBeforeEntities = DrawBeforeEntities
Me.BattleFlipped = BattleFlipped Me.BattleFlipped = BattleFlipped
If entity IsNot Nothing Then Me.Backgrounds = New List(Of Entity)
Me.CurrentEntity = entity Me.RenderObjects = New List(Of Entity)
Me.StartPosition = entity.Position
If Entity IsNot Nothing Then
Me.CurrentEntity = Entity
End If End If
AnimationSequenceBegin() AnimationSequenceBegin()
End Sub End Sub
Public Overrides Sub Draw(ByVal BV2Screen As BattleScreen) Public Overrides Sub Draw(ByVal BV2Screen As BattleScreen)
Dim Backgrounds As New List(Of Entity)
Dim RenderObjects As New List(Of Entity)
For Each a As BattleAnimation3D In Me.AnimationSequence For Each a As BattleAnimation3D In Me.AnimationSequence
If a.AnimationType = BattleAnimation3D.AnimationTypes.Background Then If Backgrounds.Contains(a) = False AndAlso a.AnimationType = BattleAnimation3D.AnimationTypes.Background Then
Backgrounds.Add(a) Backgrounds.Add(a)
End If End If
Next Next
For Each entity As BattleAnimation3D In Me.SpawnedEntities For Each entity As BattleAnimation3D In Me.SpawnedEntities
RenderObjects.Add(entity) If RenderObjects.Contains(entity) = False Then
RenderObjects.Add(entity)
End If
Next Next
If RenderObjects.Count > 0 Then If RenderObjects.Count > 0 Then
RenderObjects = (From r In RenderObjects Order By r.CameraDistance Descending).ToList() RenderObjects = (From r In RenderObjects Order By r.CameraDistance Descending).ToList()
@ -54,6 +57,8 @@ Namespace BattleSystem
[Object].UpdateModel() [Object].UpdateModel()
[Object].Render() [Object].Render()
Next Next
RenderObjects.Clear()
Backgrounds.Clear()
End Sub End Sub
Public Overrides Sub Update(BV2Screen As BattleScreen) Public Overrides Sub Update(BV2Screen As BattleScreen)
@ -98,6 +103,9 @@ Namespace BattleSystem
End Sub End Sub
Public Sub AnimationSequenceEnd() Public Sub AnimationSequenceEnd()
SpawnedEntities.Clear()
Backgrounds.Clear()
RenderObjects.Clear()
AnimationEnded = True AnimationEnded = True
End Sub End Sub
@ -194,7 +202,7 @@ Namespace BattleSystem
AnimationSequence.Add(baEntityMove) AnimationSequence.Add(baEntityMove)
End Sub End Sub
Public Sub AnimationOscillateMove(ByRef Entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal Distance As Vector3, ByVal Speed As Single, ByVal BothWays As Boolean, ByVal Duration As Single, ByVal startDelay As Single, ByVal endDelay As Single, Optional MovementCurve As Integer = 0, Optional ReturnToStart As Vector3 = Nothing) Public Sub AnimationOscillateMove(ByVal Entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal Distance As Vector3, ByVal Speed As Single, ByVal BothWays As Boolean, ByVal Duration As Single, ByVal startDelay As Single, ByVal endDelay As Single, Optional MovementCurve As Integer = 0, Optional ReturnToStart As Vector3 = Nothing)
Dim MoveEntity As Entity Dim MoveEntity As Entity
Dim ReturnPosition As New Vector3(0) Dim ReturnPosition As New Vector3(0)
@ -306,7 +314,7 @@ Namespace BattleSystem
AnimationSequence.Add(BAEntityFaceRotate) AnimationSequence.Add(BAEntityFaceRotate)
End Sub End Sub
Public Sub AnimationScale(ByVal Entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal Grow As Boolean, ByVal EndSizeX As Single, ByVal EndSizeY As Single, ByVal EndSizeZ As Single, ByVal SizeSpeed As Single, ByVal startDelay As Single, ByVal endDelay As Single, Optional ByVal Anchors As String = "") Public Sub AnimationScale(ByVal Entity As Entity, ByVal RemoveEntityAfter As Boolean, ByVal Grow As Boolean, ByVal EndSizeX As Single, ByVal EndSizeY As Single, ByVal EndSizeZ As Single, ByVal SizeSpeed As Single, ByVal startDelay As Single, ByVal endDelay As Single, Optional ByVal Anchors As String = "", Optional SpeedMultiplier As Vector3 = Nothing)
Dim ScaleEntity As Entity Dim ScaleEntity As Entity
If Entity Is Nothing Then If Entity Is Nothing Then
ScaleEntity = CurrentEntity ScaleEntity = CurrentEntity
@ -322,7 +330,7 @@ Namespace BattleSystem
Dim Scale As Vector3 = ScaleEntity.Scale Dim Scale As Vector3 = ScaleEntity.Scale
Dim EndSize As Vector3 = New Vector3(EndSizeX, EndSizeY, EndSizeZ) Dim EndSize As Vector3 = New Vector3(EndSizeX, EndSizeY, EndSizeZ)
Dim baEntityScale As BAEntityScale = New BAEntityScale(ScaleEntity, RemoveEntityAfter, Scale, Grow, EndSize, SizeSpeed, startDelay, endDelay, Anchors) Dim baEntityScale As BAEntityScale = New BAEntityScale(ScaleEntity, RemoveEntityAfter, Scale, Grow, EndSize, SizeSpeed, startDelay, endDelay, Anchors, SpeedMultiplier)
AnimationSequence.Add(baEntityScale) AnimationSequence.Add(baEntityScale)
End Sub End Sub