WaterSpeed can now also be set by GameModes

This commit is contained in:
JappaWakka 2023-10-29 13:52:48 +01:00
parent 30d3929154
commit c76ee70b08
5 changed files with 33 additions and 11 deletions

View File

@ -9,12 +9,10 @@
Dim WaterAnimation As Animation Dim WaterAnimation As Animation
Dim currentRectangle As New Rectangle(0, 0, 0, 0) Dim currentRectangle As New Rectangle(0, 0, 0, 0)
Public Shared Property WaterSpeed As Integer = 8
Public Overrides Sub Initialize() Public Overrides Sub Initialize()
MyBase.Initialize() MyBase.Initialize()
WaterAnimation = New Animation(TextureManager.GetTexture("Textures\Routes"), 1, 3, 16, 16, WaterSpeed, 15, 0) WaterAnimation = New Animation(TextureManager.GetTexture("Textures\Routes"), 1, 3, 16, 16, GameModeManager.ActiveGameMode.WaterSpeed, 15, 0)
CreateWaterTextureTemp() CreateWaterTextureTemp()
End Sub End Sub

View File

@ -83,7 +83,7 @@
Dim WaterAnimation As Animation Dim WaterAnimation As Animation
Dim CustomAnimation As Animation Dim CustomAnimation As Animation
Private _waterAnimationDelay As Single = CSng(1 / Water.WaterSpeed) Private _waterAnimationDelay As Single = CSng(1 / GameModeManager.ActiveGameMode.WaterSpeed)
Private _waterAnimationIndex As Integer = 0 Private _waterAnimationIndex As Integer = 0
Private _setTexture As Boolean = False Private _setTexture As Boolean = False
@ -111,7 +111,7 @@
Case "water" Case "water"
Me._backdropType = BackdropTypes.Water Me._backdropType = BackdropTypes.Water
Dim WaterSize As Size = New Size(CInt(TextureManager.GetTexture("Textures\Backdrops\Water").Width / 3), CInt(TextureManager.GetTexture("Textures\Backdrops\Water").Height)) Dim WaterSize As Size = New Size(CInt(TextureManager.GetTexture("Textures\Backdrops\Water").Width / 3), CInt(TextureManager.GetTexture("Textures\Backdrops\Water").Height))
WaterAnimation = New Animation(TextureManager.GetTexture("Textures\Backdrops\Water"), 1, 3, WaterSize.Width, WaterSize.Height, Water.WaterSpeed, 0, 0) WaterAnimation = New Animation(TextureManager.GetTexture("Textures\Backdrops\Water"), 1, 3, WaterSize.Width, WaterSize.Height, GameModeManager.ActiveGameMode.WaterSpeed, 0, 0)
_backdropTexture = TextureManager.GetTexture("Textures\Backdrops\Water", WaterAnimation.TextureRectangle, "") _backdropTexture = TextureManager.GetTexture("Textures\Backdrops\Water", WaterAnimation.TextureRectangle, "")
Case "grass" Case "grass"
Me._backdropType = BackdropTypes.Grass Me._backdropType = BackdropTypes.Grass
@ -124,7 +124,7 @@
Dim _frameCount As Integer Dim _frameCount As Integer
If AnimationSpeed = Nothing Then If AnimationSpeed = Nothing Then
_animationspeed = Water.WaterSpeed _animationspeed = GameModeManager.ActiveGameMode.WaterSpeed
Else Else
_animationspeed = AnimationSpeed _animationspeed = AnimationSpeed
End If End If

View File

@ -10,7 +10,7 @@
Dim Lines() As String = System.IO.File.ReadAllLines(ContentPackFile) Dim Lines() As String = System.IO.File.ReadAllLines(ContentPackFile)
For Each Line As String In Lines For Each Line As String In Lines
If Line.GetSplit(0, "|").ToLower = "waterspeed" Then If Line.GetSplit(0, "|").ToLower = "waterspeed" Then
Water.WaterSpeed = CInt(Line.GetSplit(1, "|")) GameModeManager.ForceWaterSpeed = CInt(Line.GetSplit(1, "|"))
Else Else
Select Case Line.CountSplits("|") Select Case Line.CountSplits("|")
Case 2 'ResolutionChange Case 2 'ResolutionChange

View File

@ -3,6 +3,7 @@ Public Class GameModeManager
Private Shared GameModeList As New List(Of GameMode) Private Shared GameModeList As New List(Of GameMode)
Private Shared GameModePointer As Integer = 0 Private Shared GameModePointer As Integer = 0
Public Shared Initialized As Boolean = False Public Shared Initialized As Boolean = False
Public Shared ForceWaterSpeed As Integer = -1
''' <summary> ''' <summary>
''' Loads (or reloads) the list of GameModes. The pointer also gets reset. ''' Loads (or reloads) the list of GameModes. The pointer also gets reset.
@ -385,7 +386,7 @@ Public Class GameMode
''' <param name="SkinNames">The skin names for the new GameMode. Must be the same amount as SkinFiles and SkinColors.</param> ''' <param name="SkinNames">The skin names for the new GameMode. Must be the same amount as SkinFiles and SkinColors.</param>
''' <param name="SkinGenders">The skin names for the new GameMode. Must be the same amount as SkinFiles and SkinColors.</param> ''' <param name="SkinGenders">The skin names for the new GameMode. Must be the same amount as SkinFiles and SkinColors.</param>
Public Sub New(ByVal Name As String, ByVal Description As String, ByVal Version As String, ByVal Author As String, ByVal MapPath As String, ByVal ScriptPath As String, ByVal PokeFilePath As String, ByVal PokemonDataPath As String, ByVal ContentPath As String, ByVal LocalizationsPath As String, ByVal GameRules As List(Of GameRule), ByVal HardGameRules As List(Of GameRule), Public Sub New(ByVal Name As String, ByVal Description As String, ByVal Version As String, ByVal Author As String, ByVal MapPath As String, ByVal ScriptPath As String, ByVal PokeFilePath As String, ByVal PokemonDataPath As String, ByVal ContentPath As String, ByVal LocalizationsPath As String, ByVal GameRules As List(Of GameRule), ByVal HardGameRules As List(Of GameRule),
ByVal StartMap As String, ByVal StartPosition As Vector3, ByVal StartRotation As Single, ByVal StartLocationName As String, ByVal StartDialogue As String, ByVal StartColor As Color, ByVal PokemonAppear As String, ByVal IntroMusic As String, ByVal IntroType As String, ByVal SkinColors As List(Of Color), ByVal SkinFiles As List(Of String), ByVal SkinNames As List(Of String), ByVal SkinGenders As List(Of String)) ByVal StartMap As String, ByVal StartPosition As Vector3, ByVal StartRotation As Single, ByVal StartLocationName As String, ByVal StartDialogue As String, ByVal StartColor As Color, ByVal PokemonAppear As String, ByVal IntroMusic As String, ByVal IntroType As String, ByVal SkinColors As List(Of Color), ByVal SkinFiles As List(Of String), ByVal SkinNames As List(Of String), ByVal SkinGenders As List(Of String), Optional WaterSpeed As Integer = 8)
Me._name = Name Me._name = Name
Me._description = Description Me._description = Description
Me._version = Version Me._version = Version
@ -398,6 +399,7 @@ Public Class GameMode
Me._localizationsPath = LocalizationsPath Me._localizationsPath = LocalizationsPath
Me._gameRules = GameRules Me._gameRules = GameRules
Me._hardGameRules = HardGameRules Me._hardGameRules = HardGameRules
Me._waterspeed = WaterSpeed
Me._startMap = StartMap Me._startMap = StartMap
Me._startPosition = StartPosition Me._startPosition = StartPosition
@ -479,6 +481,8 @@ Public Class GameMode
End If End If
Next Next
End If End If
Case "waterspeed"
Me._waterspeed = CInt(Value)
Case "startmap" Case "startmap"
Me._startMap = Value Me._startMap = Value
Case "startposition" Case "startposition"
@ -590,7 +594,7 @@ Public Class GameMode
Dim SkinGenders As List(Of String) = {"Male", "Female", "Male", "Female", "Male", "Female"}.ToList() Dim SkinGenders As List(Of String) = {"Male", "Female", "Male", "Female", "Male", "Female"}.ToList()
Dim gameMode As New GameMode("Kolben", "The normal game mode.", GameController.GAMEVERSION, "Kolben Games", "\Content\Data\maps\", "\Content\Data\Scripts\", "\Content\Data\maps\poke\", "\Content\Pokemon\Data\", "\Content\", "\Content\Localization\", New List(Of GameRule), New List(Of GameRule), Dim gameMode As New GameMode("Kolben", "The normal game mode.", GameController.GAMEVERSION, "Kolben Games", "\Content\Data\maps\", "\Content\Data\Scripts\", "\Content\Data\maps\poke\", "\Content\Pokemon\Data\", "\Content\", "\Content\Localization\", New List(Of GameRule), New List(Of GameRule),
"newgame\intro0.dat", New Vector3(1.0F, 0.1F, 3.0F), MathHelper.PiOver2, "Your Room", "", New Color(59, 123, 165), "0", "welcome", "1", SkinColors, SkinFiles, SkinNames, SkinGenders) "newgame\intro0.dat", New Vector3(1.0F, 0.1F, 3.0F), MathHelper.PiOver2, "Your Room", "", New Color(59, 123, 165), "0", "welcome", "1", SkinColors, SkinFiles, SkinNames, SkinGenders, 8)
gameMode.StartScript = "startscript\main" gameMode.StartScript = "startscript\main"
@ -634,7 +638,9 @@ Public Class GameMode
"PokeFilePath|" & Me._pokeFilePath & Environment.NewLine & "PokeFilePath|" & Me._pokeFilePath & Environment.NewLine &
"PokemonDataPath|" & Me._pokemonDataPath & Environment.NewLine & "PokemonDataPath|" & Me._pokemonDataPath & Environment.NewLine &
"ContentPath|" & Me._contentPath & Environment.NewLine & "ContentPath|" & Me._contentPath & Environment.NewLine &
"LocalizationsPath|" & Me._localizationsPath & Environment.NewLine "LocalizationsPath|" & Me._localizationsPath & Environment.NewLine &
"WaterSpeed|" & _waterspeed & Environment.NewLine
Dim GameRuleString As String = "GameRules|" Dim GameRuleString As String = "GameRules|"
For Each rule As GameRule In Me._gameRules For Each rule As GameRule In Me._gameRules
@ -755,6 +761,7 @@ Public Class GameMode
Private _contentPath As String = "" Private _contentPath As String = ""
Private _gameRules As New List(Of GameRule) Private _gameRules As New List(Of GameRule)
Private _hardGameRules As New List(Of GameRule) Private _hardGameRules As New List(Of GameRule)
Private _waterspeed As Integer = 8
''' <summary> ''' <summary>
''' The name of this GameMode. ''' The name of this GameMode.
@ -875,6 +882,23 @@ Public Class GameMode
Me._localizationsPath = value Me._localizationsPath = value
End Set End Set
End Property End Property
''' <summary>
''' The speed at which water should animate.
''' </summary>
Public Property WaterSpeed As Integer
Get
If GameModeManager.ForceWaterSpeed <> -1 Then
Return GameModeManager.ForceWaterSpeed
Else
Return Me._waterspeed
End If
End Get
Set(value As Integer)
Me._waterspeed = value
End Set
End Property
''' <summary> ''' <summary>
''' The GameRules that apply to this GameMode. ''' The GameRules that apply to this GameMode.

View File

@ -516,7 +516,7 @@ Public Class NewOptionScreen
FontManager.LoadFonts() FontManager.LoadFonts()
MusicManager.PlayNoMusic() MusicManager.PlayNoMusic()
ContentPackManager.Clear() ContentPackManager.Clear()
Water.WaterSpeed = 8 GameModeManager.ForceWaterSpeed = -1
For Each s As String In Core.GameOptions.ContentPackNames For Each s As String In Core.GameOptions.ContentPackNames
ContentPackManager.Load(GameController.GamePath & "\ContentPacks\" & s & "\exceptions.dat") ContentPackManager.Load(GameController.GamePath & "\ContentPacks\" & s & "\exceptions.dat")
Next Next