Merge pull request #209 from maxrigout/master

added night theme for wild battles
This commit is contained in:
Jasper Speelman 2025-02-21 12:42:19 +01:00 committed by GitHub
commit 4d5173fab4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 91 additions and 16 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -17885,6 +17885,9 @@
<Content Include="Content\Songs\intro\johto_wild.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Songs\intro\johto_wild_night.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Songs\intro\kanto_leader.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@ -18071,6 +18074,12 @@
<Content Include="Content\Songs\johto_wild_intro.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Songs\johto_wild_intro_night.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Songs\johto_wild_night.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Songs\kanto_leader.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>

View File

@ -19,6 +19,15 @@
Dim startTime As Date
Dim duration As TimeSpan
Public Enum BattleType As Integer
PVP = 0
TRAINER = 1
SAFARI = 2
BUG_CATCHING = 3
ROAMING = 4
WILD = 5
End Enum
Public MusicLoop As String = ""
Public Sub New(ByVal OldScreen As Screen, ByVal NewScreen As Screen, ByVal IntroType As Integer)
@ -33,6 +42,10 @@
End If
End If
If ShouldPlayNightTheme(musicLoop) Then
musicLoop = musicLoop & "_night"
End If
If MusicManager.SongExists(musicLoop) = False Then
musicLoop = "johto_wild_intro"
End If
@ -51,6 +64,10 @@
End If
End If
If ShouldPlayNightTheme(MusicLoop) Then
MusicLoop = MusicLoop & "_night"
End If
If MusicManager.SongExists(MusicLoop) = False Then
MusicLoop = "johto_wild_intro"
End If
@ -280,7 +297,6 @@
Dim t2 As Texture2D = TextureManager.GetTexture("GUI\Intro\VSIntro", New Rectangle(CInt(VSPosition.X), CInt(VSPosition.Y), 64, 64), "")
Dim t3 As Texture2D = TextureManager.GetTexture(TrainerTexture1, New Rectangle(0, Trainer1FrameSize.Height * 2, Trainer1FrameSize.Width, Trainer1FrameSize.Height))
If Trainer.GameJoltID <> "" Then
If GameJolt.Emblem.HasDownloadedSprite(Trainer.GameJoltID) = True Then
Dim t As Texture2D = GameJolt.Emblem.GetOnlineSprite(Trainer.GameJoltID)
@ -550,29 +566,27 @@
MusicManager.Playlist.Clear()
MusicManager.outputDevice.Stop()
If BattleSystem.BattleScreen.CustomBattleMusic = "" OrElse MusicManager.SongExists(BattleSystem.BattleScreen.CustomBattleMusic) = False Then
Dim battleType = BattleIntroScreen.BattleType.WILD
If b.IsPVPBattle = True Then
MusicManager.Play(MusicLoop, False, 0.0F, True, "pvp")
battleType = BattleIntroScreen.BattleType.PVP
Else
If b.IsTrainerBattle = True Then
MusicManager.Play(MusicLoop, False, 0.0F, True, Trainer.GetBattleMusicName())
ElseIf Screen.Level.IsSafariZone = True Or Screen.Level.IsBugCatchingContest = True Then
If MusicManager.SongExists(Screen.Level.CurrentRegion.Split(CChar(","))(0) & "_wild") = True Then
MusicManager.Play(MusicLoop, False, 0.0F, True, Screen.Level.CurrentRegion.Split(CChar(","))(0) & "_wild")
battleType = BattleIntroScreen.BattleType.TRAINER
ElseIf Screen.Level.IsSafariZone = True Then
battleType = BattleIntroScreen.BattleType.SAFARI
ElseIf Screen.Level.IsBugCatchingContest = True Then
battleType = BattleIntroScreen.BattleType.BUG_CATCHING
Else
MusicManager.Play(MusicLoop, False, 0.0F, True, "johto_wild")
End If
If BattleSystem.BattleScreen.RoamingBattle = True Then
battleType = BattleIntroScreen.BattleType.ROAMING
Else
If BattleSystem.BattleScreen.RoamingBattle = True AndAlso BattleSystem.BattleScreen.RoamingPokemonStorage.MusicLoop <> "" AndAlso MusicManager.SongExists(BattleSystem.BattleScreen.RoamingPokemonStorage.MusicLoop) = True Then
MusicManager.Play(MusicLoop, True, 0.0F, True, BattleSystem.BattleScreen.RoamingPokemonStorage.MusicLoop)
Else
If MusicManager.SongExists(Screen.Level.CurrentRegion.Split(CChar(","))(0) & "_wild") = True Then
MusicManager.Play(MusicLoop, False, 0.0F, True, Screen.Level.CurrentRegion.Split(CChar(","))(0) & "_wild")
Else
MusicManager.Play(MusicLoop, False, 0.0F, True, "johto_wild")
End If
battleType = BattleIntroScreen.BattleType.WILD
End If
End If
End If
Dim loopSong = GetLoopSong(battleType)
MusicManager.Play(MusicLoop, True, 0.0F, True, loopSong)
Else
MusicManager.Play(MusicLoop, True, 0.0F, True, BattleSystem.BattleScreen.CustomBattleMusic)
End If
@ -592,10 +606,57 @@
Me.startTime = Date.Now
End Sub
Private Function GetLoopSong(battleType As BattleIntroScreen.BattleType) As String
'pvp battle
'trainer battle
'safari zone
'bug catching contest
'roaming battle
'wild pokemon
Dim fallbackLoopSong = "johto_wild"
Dim loopSong = Screen.Level.CurrentRegion.Split(CChar(","))(0) & "_wild"
If battleType = BattleIntroScreen.BattleType.PVP Then
loopSong = "pvp"
ElseIf battleType = BattleIntroScreen.BattleType.TRAINER Then
fallbackLoopSong = Trainer.GetBattleMusicName()
loopSong = Trainer.GetBattleMusicName()
ElseIf battleType = BattleIntroScreen.BattleType.SAFARI Then
fallbackLoopSong = "johto_wild"
loopSong = Screen.Level.CurrentRegion.Split(CChar(","))(0) & "_wild"
ElseIf battleType = BattleIntroScreen.BattleType.BUG_CATCHING Then
fallbackLoopSong = "johto_wild"
loopSong = Screen.Level.CurrentRegion.Split(CChar(","))(0) & "_wild"
ElseIf battleType = BattleIntroScreen.BattleType.ROAMING Then
If BattleSystem.BattleScreen.RoamingPokemonStorage.MusicLoop <> "" Then
loopSong = BattleSystem.BattleScreen.RoamingPokemonStorage.MusicLoop
End If
ElseIf battleType = BattleIntroScreen.BattleType.WILD Then
fallbackLoopSong = "johto_wild"
loopSong = Screen.Level.CurrentRegion.Split(CChar(","))(0) & "_wild"
Else
Console.WriteLine("Unknown Battle Type: " & battleType)
End If
If ShouldPlayNightTheme(loopSong) Then
loopSong = loopSong & "_night"
fallbackLoopSong = "johto_wild_night"
End If
If MusicManager.SongExists(loopSong) = True Then
Return loopSong
End If
Return fallbackLoopSong
End Function
Private Function SongOver() As Boolean
Return startTime + duration < Date.Now
End Function
Private Function ShouldPlayNightTheme(dayThemeName As String) As Boolean
Return World.IsNight() And MusicManager.SongExists(dayThemeName & "_night")
End Function
'Protected Overrides Sub Finalize()
' If blurTexture IsNot Nothing
' blurTexture.Dispose()

View File

@ -982,4 +982,9 @@ endsub:
End Set
End Property
Public Shared Function IsNight() As Boolean
Dim currentTime = GetTime()
Return currentTime.Equals(DayTimes.Night) Or currentTime.Equals(DayTimes.Evening)
End Function
End Class