Made trainer battle intros look better

And also made it so that the battleintros get skipped if the _intro music is equal to or smaller than 1 second (useful for silent intros)
I also made sure trainer sprite scaling and positioning is correct
This commit is contained in:
JappaWakka 2023-03-18 20:47:12 +01:00
parent 5819ca30fe
commit b9f6637365
1 changed files with 22 additions and 20 deletions

View File

@ -206,7 +206,14 @@
If GameJolt.Emblem.HasDownloadedSprite(Trainer.GameJoltID) = True Then
Dim t As Texture2D = GameJolt.Emblem.GetOnlineSprite(Trainer.GameJoltID)
If Not t Is Nothing Then
Dim spriteSize As New Vector2(CInt(t.Width / 3), CInt(t.Height / 4))
Dim spriteSize As Vector2
If t.Width = t.Height / 2 Then
spriteSize = New Vector2(CInt(t.Width / 2), CInt(t.Height / 4))
ElseIf t.Width = t.Height Then
spriteSize = New Vector2(CInt(t.Width / 4), CInt(t.Height / 4))
Else
spriteSize = New Vector2(CInt(t.Width / 3), CInt(t.Height / 4))
End If
t3 = TextureManager.GetTexture(t, New Rectangle(0, CInt(spriteSize.Y * 2), CInt(spriteSize.X), CInt(spriteSize.Y)))
End If
End If
@ -227,13 +234,13 @@
Dim t As String = ReplaceIntroName(Trainer.TrainerType) & " " & ReplaceIntroName(Trainer.Name) & " & " & ReplaceIntroName(Trainer.TrainerType2) & " " & ReplaceIntroName(Trainer.Name2)
Core.SpriteBatch.DrawString(FontManager.InGameFont, t, New Vector2(Core.windowSize.Width - FontManager.InGameFont.MeasureString(t).X - 50, CInt(Core.windowSize.Height / 2 + 20)), Color.White)
Core.SpriteBatch.Draw(t3, New Rectangle(Core.windowSize.Width - 540, CInt(Core.windowSize.Height / 2 - 230), 256, 256), Color.White)
Core.SpriteBatch.Draw(t4, New Rectangle(Core.windowSize.Width - 280, CInt(Core.windowSize.Height / 2 - 230), 256, 256), Color.White)
Core.SpriteBatch.Draw(t3, New Rectangle(Core.windowSize.Width - 540, CInt(Core.windowSize.Height / 2 - 96 - (MathHelper.Min(t3.Height * 10, 256) / 2)), MathHelper.Min(t3.Width * 10, 256), MathHelper.Min(t3.Height * 10, 256)), Color.White)
Core.SpriteBatch.Draw(t4, New Rectangle(Core.windowSize.Width - 280, CInt(Core.windowSize.Height / 2 - 96 - (MathHelper.Min(t4.Height * 10, 256) / 2)), MathHelper.Min(t4.Width * 10, 256), MathHelper.Min(t4.Height * 10, 256)), Color.White)
Else
Dim t As String = ReplaceIntroName(Trainer.TrainerType) & " " & ReplaceIntroName(Trainer.Name)
Core.SpriteBatch.DrawString(FontManager.InGameFont, t, New Vector2(Core.windowSize.Width - FontManager.InGameFont.MeasureString(t).X - 50, CInt(Core.windowSize.Height / 2 + 20)), Color.White)
Core.SpriteBatch.Draw(t3, New Rectangle(Core.windowSize.Width - 310, CInt(Core.windowSize.Height / 2 - 230), 256, 256), Color.White)
Core.SpriteBatch.Draw(t3, New Rectangle(Core.windowSize.Width - 310, CInt(Core.windowSize.Height / 2 - 97 - (MathHelper.Min(t3.Height * 10, 256) / 2)), MathHelper.Min(t3.Width * 10, 256), MathHelper.Min(t3.Height * 10, 256)), Color.White)
End If
Core.SpriteBatch.Draw(t2, New Rectangle(420 - CInt(CInt(1.29 * value) / 3), CInt(Core.windowSize.Height / 2 - 20) - CInt(CInt(1 * value) / 3), CInt(1.12 * CInt(value / 1.5F)), 1 * CInt(value / 1.5F)), Color.White)
End Sub
@ -256,9 +263,7 @@
Dim barPosition As Vector2 = New Vector2(Trainer.BarImagePosition.X * 128, Trainer.BarImagePosition.Y * 128)
Dim VSPosition As Vector2 = New Vector2(Trainer.VSImagePosition.X * 128, Trainer.VSImagePosition.Y * 128 + 64)
Dim TrainerTexture1 As Texture2D = TextureManager.GetTexture("Textures\NPC\" & Trainer.SpriteName)
Dim TrainerTexture2 As Texture2D = Nothing
Dim Trainer1FrameSize As Size = Nothing
Dim Trainer2FrameSize As Size = Nothing
If TrainerTexture1.Width = TrainerTexture1.Height / 2 Then
Trainer1FrameSize = New Size(CInt(TrainerTexture1.Width / 2), CInt(TrainerTexture1.Height / 4))
@ -271,18 +276,7 @@
Dim t1 As Texture2D = TextureManager.GetTexture("GUI\Intro\VSIntro", New Rectangle(CInt(barPosition.X), CInt(barPosition.Y), 128, 64), "")
Dim t2 As Texture2D = TextureManager.GetTexture("GUI\Intro\VSIntro", New Rectangle(CInt(VSPosition.X), CInt(VSPosition.Y), 61, 54), "")
Dim t3 As Texture2D = TextureManager.GetTexture(TrainerTexture1, New Rectangle(0, Trainer1FrameSize.Height * 2, Trainer1FrameSize.Width, Trainer1FrameSize.Height))
Dim t4 As Texture2D = Nothing
If Trainer.DoubleTrainer = True Then
TrainerTexture2 = TextureManager.GetTexture("Textures\NPC\" & Trainer.SpriteName2)
If TrainerTexture1.Width = TrainerTexture1.Height / 2 Then
Trainer2FrameSize = New Size(CInt(TrainerTexture2.Width / 2), CInt(TrainerTexture2.Height / 4))
ElseIf TrainerTexture1.Width = TrainerTexture1.Height Then
Trainer2FrameSize = New Size(CInt(TrainerTexture2.Width / 4), CInt(TrainerTexture2.Height / 4))
Else
Trainer2FrameSize = New Size(CInt(TrainerTexture2.Width / 3), CInt(TrainerTexture2.Height / 4))
End If
t4 = TextureManager.GetTexture("NPC\" & Trainer.SpriteName2, New Rectangle(0, Trainer2FrameSize.Height * 2, Trainer2FrameSize.Width, Trainer2FrameSize.Height))
End If
If Trainer.GameJoltID <> "" Then
If GameJolt.Emblem.HasDownloadedSprite(Trainer.GameJoltID) = True Then
@ -311,7 +305,7 @@
Next
Canvas.DrawRectangle(New Rectangle(0, 0, Core.windowSize.Width, blackPosition), Color.Black)
Core.SpriteBatch.Draw(t3, New Rectangle(CInt(Core.windowSize.Width - trainerPosition), CInt(Core.windowSize.Height / 2 - 96), 256, 224), New Rectangle(0, 0, t3.Width, CInt(t3.Height * 0.875)), Color.White)
Core.SpriteBatch.Draw(t3, New Rectangle(CInt(Core.windowSize.Width - trainerPosition), CInt(Core.windowSize.Height / 2 + 128 - (CInt(MathHelper.Min(t3.Height * 10, 256) * 0.875))), MathHelper.Min(t3.Width * 10, 256), CInt(MathHelper.Min(t3.Height * 10, 256) * 0.875)), New Rectangle(0, 0, t3.Width, CInt(t3.Height * 0.875)), Color.White)
Core.SpriteBatch.Draw(t2, New Rectangle(trainerPosition - 61 * 4, CInt(Core.windowSize.Height / 2) - 96, 61 * 4, 54 * 4), Color.White)
Canvas.DrawRectangle(New Rectangle(0, Core.windowSize.Height - blackPosition, Core.windowSize.Width, blackPosition), Color.Black)
@ -578,9 +572,17 @@
MusicManager.Play(MusicLoop, True, 0.0F, False, BattleSystem.BattleScreen.CustomBattleMusic)
End If
If Not MusicLoop Is Nothing Then
Me.duration = MusicManager.GetSong(MusicLoop).Duration
If MusicManager.GetSong(MusicLoop).Duration.TotalSeconds <= 1 Then
Me.duration = New TimeSpan(0)
minDelay = 0
ready = True
Else
Me.duration = MusicManager.GetSong(MusicLoop).Duration
End If
Else
Me.duration = New TimeSpan(0)
minDelay = 0
ready = True
End If
Me.startTime = Date.Now
End Sub