From eea9d543be203f705e054d0a81609321977aab11 Mon Sep 17 00:00:00 2001 From: JappaWakka Date: Wed, 16 Feb 2022 21:47:00 +0100 Subject: [PATCH] Improved NewGameScreen and NewNewGameScreen Ported skin selection and naming screens from 3d newgame intro to 2d newgame intro and made sure that there are no bad symbols in the foldernames. --- P3D/Screens/MainMenu/NewNewGameScreen.vb | 8 +- P3D/Screens/NewGameScreen.vb | 821 ++++++++++------------- 2 files changed, 378 insertions(+), 451 deletions(-) diff --git a/P3D/Screens/MainMenu/NewNewGameScreen.vb b/P3D/Screens/MainMenu/NewNewGameScreen.vb index 995f846f2..06bda6a75 100644 --- a/P3D/Screens/MainMenu/NewNewGameScreen.vb +++ b/P3D/Screens/MainMenu/NewNewGameScreen.vb @@ -67,7 +67,11 @@ End If If ActionScript.Scripts.Count = 0 Then If CurrentScreen.Identification = Screen.Identifications.NewGameScreen Then - Core.SetScreen(New TransitionScreen(CurrentScreen, New OverworldScreen(), Color.Black, False, AddressOf RemoveFade)) + If OverworldScreen.FadeValue > 0 Then + Core.SetScreen(New TransitionScreen(CurrentScreen, New OverworldScreen(), Color.Black, False, AddressOf RemoveFade)) + Else + Core.SetScreen(New OverworldScreen()) + End If Else 'Dim fadeSpeed As Integer = 12 'If OverworldScreen.FadeValue > 0 Then @@ -115,7 +119,7 @@ End Sub Public Shared Sub EndNewGame(ByVal map As String, ByVal x As Single, ByVal y As Single, ByVal z As Single, ByVal rot As Integer) - Dim folderPath As String = Core.Player.Name + Dim folderPath As String = Core.Player.Name.Replace("\", "_").Replace("/", "_").Replace(":", "_").Replace("*", "_").Replace("?", "_").Replace("""", "_").Replace("<", "_").Replace(">", "_").Replace("|", "_").Replace(",", "_").Replace(".", "_") Dim folderPrefix As Integer = 0 If folderPath.ToLower() = "autosave" Then diff --git a/P3D/Screens/NewGameScreen.vb b/P3D/Screens/NewGameScreen.vb index cc9e1b52b..9433c6f65 100644 --- a/P3D/Screens/NewGameScreen.vb +++ b/P3D/Screens/NewGameScreen.vb @@ -1,458 +1,379 @@ -Public Class NewGameScreen +Namespace Screens.MainMenu + Public Class NewGameScreen - Inherits Screen + Inherits Screen - Dim skinFiles() As String = {GameModeManager.ActiveGameMode.SkinFiles.ToString} - Dim skinNames() As String = {GameModeManager.ActiveGameMode.SkinNames.ToString} - Dim skinGenders() As String = {GameModeManager.ActiveGameMode.SkinGenders.ToString} - Dim skinColors As List(Of Color) = GameModeManager.ActiveGameMode.SkinColors + Dim skinFiles() As String = {GameModeManager.ActiveGameMode.SkinFiles.ToString} + Dim skinNames() As String = {GameModeManager.ActiveGameMode.SkinNames.ToString} + Dim skinGenders() As String = {GameModeManager.ActiveGameMode.SkinGenders.ToString} + Dim skinColors As List(Of Color) = GameModeManager.ActiveGameMode.SkinColors - Public Index As Integer = 0 - Dim pokeIndex As Integer = 0 + Public Index As Integer = 0 + Dim pokeIndex As Integer = 0 - Dim ProfAlpha As Integer = 0 - Dim OtherAlpha As Integer = 0 + Dim ProfAlpha As Integer = 0 + Dim OtherAlpha As Integer = 0 - Dim Name As String = "" - Dim SkinIndex As Integer = 0 - Dim skinTexture As Texture2D - Dim enterCorrectName As Boolean = False - Dim nameMessage As String = "This name is too short." + Dim Name As String = "" + Dim SkinIndex As Integer = 0 + Dim skinTexture As Texture2D + Dim enterCorrectName As Boolean = False + Dim nameMessage As String = "This name is too short." - Dim mainTexture As Texture2D - Dim pokeTexture As Texture2D + Dim mainTexture As Texture2D + Dim pokeTexture As Texture2D - Dim ballPosition As Vector2 - Dim ballIndex As Vector2 = New Vector2(0, 0) - Dim ballAnimationDelay As Single = 0.2F - Dim ballVelocity As Single = -4.0F - Dim pokePosition As Vector2 - Dim pokeID As Integer = 0 + Dim ballPosition As Vector2 + Dim ballIndex As Vector2 = New Vector2(0, 0) + Dim ballAnimationDelay As Single = 0.2F + Dim ballVelocity As Single = -4.0F + Dim pokePosition As Vector2 + Dim pokeID As Integer = 0 - Dim CurrentText As String = "" + Dim CurrentText As String = "" - Dim currentBackColor As Color = New Color(59, 123, 165) - Dim normalColor As Color = New Color(59, 123, 165) + Dim currentBackColor As Color = New Color(59, 123, 165) + Dim normalColor As Color = New Color(59, 123, 165) - Dim pokemonRange() As Integer = {1, 252} - Dim introMusic As String = "welcome" - Dim startMap As String = "yourroom.dat" - Dim startPosition As Vector3 = New Vector3(1, 0.1F, 3) - Dim startLocation As String = "Your Room" - Dim startYaw As Single = MathHelper.PiOver2 + Dim pokemonRange() As Integer = {1, 252} + Dim introMusic As String = "welcome" + Dim startMap As String = "yourroom.dat" + Dim startPosition As Vector3 = New Vector3(1, 0.1F, 3) + Dim startLocation As String = "Your Room" + Dim startYaw As Single = MathHelper.PiOver2 - Dim Dialogues As New List(Of String) + Dim Dialogues As New List(Of String) - Public Sub New() - For Each s As String In Core.GameOptions.ContentPackNames - ContentPackManager.Load(GameController.GamePath & "\ContentPacks\" & s & "\exceptions.dat") - Next + Public Sub New() + For Each s As String In Core.GameOptions.ContentPackNames + ContentPackManager.Load(GameController.GamePath & "\ContentPacks\" & s & "\exceptions.dat") + Next - BattleSystem.GameModeAttackLoader.Load() + BattleSystem.GameModeAttackLoader.Load() - If GameModeManager.ActiveGameMode.IsDefaultGamemode = False Then - 'MusicManager.LoadMusic(True) - 'SoundManager.LoadSounds(True) - End If - SmashRock.Load() - Badge.Load() - Pokedex.Load() - BattleSystem.BattleScreen.ResetVars() - LevelLoader.ClearTempStructures() - PokemonForms.Initialize() - - Me.Identification = Identifications.NewGameScreen - Me.CanChat = False - mainTexture = TextureManager.GetTexture("GUI\Intro") - - LoadIntroValues() - - Dim p As Pokemon = Pokemon.GetPokemonByID(Core.Random.Next(pokemonRange(0), pokemonRange(1))) - p.Generate(1, True) - pokeID = p.Number - pokeTexture = p.GetTexture(True) - - CurrentText = "" - - TextBox.Showing = False - Me.Index = 0 - TextBox.reDelay = 0 - Dim skinTexture2D = TextureManager.GetTexture("Textures\NPC\" & skinFiles(SkinIndex)) - Dim skinRectangle As New Rectangle(0, CInt(skinTexture2D.Height / 4 * 2), CInt(skinTexture2D.Width / 3), CInt(skinTexture2D.Height / 4)) - skinTexture = TextureManager.GetTexture(skinTexture2D, skinRectangle) - - MusicManager.Play("nomusic") - End Sub - - Private Sub LoadIntroValues() - Dim GameMode As GameMode = GameModeManager.ActiveGameMode - - Me.skinNames = GameMode.SkinNames.ToArray() - Me.skinFiles = GameMode.SkinFiles.ToArray() - Me.skinGenders = GameMode.SkinGenders.ToArray() - Me.skinColors = GameMode.SkinColors - - Me.pokemonRange = GameMode.PokemonRange - Me.introMusic = GameMode.IntroMusic - Me.startMap = GameMode.StartMap - Me.startPosition = GameMode.StartPosition - Me.startLocation = GameMode.StartLocationName - Me.startYaw = GameMode.StartRotation - Me.normalColor = GameMode.StartColor - Me.currentBackColor = GameMode.StartColor - - If GameMode.StartDialogue <> "" Then - If GameMode.StartDialogue.CountSplits("|") >= 3 Then - Dim Splits() As String = GameMode.StartDialogue.Split(CChar("|")) - Me.Dialogues.AddRange(Splits) + If GameModeManager.ActiveGameMode.IsDefaultGamemode = False Then + 'MusicManager.LoadMusic(True) + 'SoundManager.LoadSounds(True) End If - Else - If Me.Dialogues.Count < 3 Then - Me.Dialogues.Clear() - Me.Dialogues.AddRange({Localization.GetString("new_game_intro_1"), Localization.GetString("new_game_intro_2"), Localization.GetString("new_game_intro_3")}) - End If - End If - End Sub + SmashRock.Load() + Badge.Load() + Pokedex.Load() + BattleSystem.BattleScreen.ResetVars() + LevelLoader.ClearTempStructures() + PokemonForms.Initialize() - Public Overrides Sub Update() - If Index = 5 Then - Core.GameInstance.IsMouseVisible = True - Else - Core.GameInstance.IsMouseVisible = False - End If + Me.Identification = Identifications.NewGameScreen + Me.CanChat = False + mainTexture = TextureManager.GetTexture("GUI\Intro") - If ProfAlpha < 255 And Index = 0 Then - ProfAlpha += 2 - If ProfAlpha >= 255 Then - MusicManager.Play(Me.introMusic, True, 0.0F) - End If - ElseIf ProfAlpha >= 255 Or Index > 0 Then - TextBox.Update() + LoadIntroValues() - If TextBox.Showing = False Then - Select Case Index - Case 1 - UpdatePokemon() - Case 3 - UpdateTransition(False) - Case 5 - UpdateTextbox() - Case 7 - UpdateTransition(True) - Case 9 - If ProfAlpha > 0 Then - ProfAlpha -= 2 - End If - If ProfAlpha <= 0 Then - CreateGame() - End If - Case 4 - UpdateChooseSkin() - Case Else - ShowText() - End Select - End If - End If + Dim p As Pokemon = Pokemon.GetPokemonByID(Core.Random.Next(pokemonRange(0), pokemonRange(1))) + p.Generate(1, True) + pokeID = p.Number + pokeTexture = p.GetTexture(True) - Dim AimColor As Color = normalColor + CurrentText = "" - If Me.Index = 4 Then - AimColor = skinColors(SkinIndex) - End If - - Dim diffR As Byte = 5 - If (CInt(currentBackColor.R) - CInt(AimColor.R)).ToPositive() < 5 Then - diffR = 1 - End If - Dim diffG As Byte = 5 - If (CInt(currentBackColor.G) - CInt(AimColor.G)).ToPositive() < 5 Then - diffG = 1 - End If - Dim diffB As Byte = 5 - If (CInt(currentBackColor.B) - CInt(AimColor.B)).ToPositive() < 5 Then - diffB = 1 - End If - If currentBackColor.R < AimColor.R Then - currentBackColor.R += diffR - ElseIf currentBackColor.R > AimColor.R Then - currentBackColor.R -= diffR - End If - If currentBackColor.G < AimColor.G Then - currentBackColor.G += diffG - ElseIf currentBackColor.G > AimColor.G Then - currentBackColor.G -= diffG - End If - If currentBackColor.B < AimColor.B Then - currentBackColor.B += diffB - ElseIf currentBackColor.B > AimColor.B Then - currentBackColor.B -= diffB - End If - End Sub - - Private Sub ShowText() - Dim Text As String = "" - - Select Case Index - Case 0 - Text = Dialogues(0) - Case 2 - Text = Dialogues(1) - Case 6 - Text = NameReaction(Name) - Case 8 - Text = Name & Dialogues(2) - End Select - - TextBox.reDelay = 0 - TextBox.Show(Text, {}) - - Index += 1 - End Sub - - - Public Overrides Sub Draw() - Canvas.DrawRectangle(New Rectangle(0, 0, Core.windowSize.Width, Core.windowSize.Height), currentBackColor) - - TextBox.Draw() - - Core.SpriteBatch.Draw(mainTexture, New Rectangle(CInt(Core.windowSize.Width / 2) - 62, CInt(Core.windowSize.Height / 2) - 218, 130, 256), New Rectangle(0, 0, 62, 128), New Color(255, 255, 255, ProfAlpha)) - Core.SpriteBatch.Draw(skinTexture, New Rectangle(CInt(Core.windowSize.Width / 2) - 128, CInt(Core.windowSize.Height / 2) - 218, 256, 256), New Color(255, 255, 255, OtherAlpha)) - - Select Case pokeIndex - Case 1 - Core.SpriteBatch.Draw(mainTexture, New Rectangle(CInt(ballPosition.X), CInt(ballPosition.Y), 22, 22), New Rectangle(62 + CInt(ballIndex.X * 22), 48 + CInt(ballIndex.Y * 22), 22, 22), Color.White) - Case 2 - Core.SpriteBatch.Draw(pokeTexture, New Rectangle(CInt(pokePosition.X) - 100, CInt(pokePosition.Y) - 218, 256, 256), Color.White) - Case 3 - If Index < 6 Then - Core.SpriteBatch.Draw(pokeTexture, New Rectangle(CInt(Core.windowSize.Width / 2) - 300, CInt(Core.windowSize.Height / 2) - 218, 256, 256), New Color(255, 255, 255, ProfAlpha)) - End If - End Select - - Select Case Index - Case 5 - Core.SpriteBatch.DrawString(FontManager.MainFont, Localization.GetString("new_game_your_name") & ": ", New Vector2(TextboxPosition.X + 2, TextboxPosition.Y - 32 + 2), Color.Black) - Core.SpriteBatch.DrawString(FontManager.MainFont, Localization.GetString("new_game_your_name") & ": ", New Vector2(TextboxPosition.X, TextboxPosition.Y - 32), Color.White) - DrawTextBox() - - If enterCorrectName = True Then - Core.SpriteBatch.DrawString(FontManager.MainFont, Localization.GetString("new_game_name_too_short"), New Vector2(TextboxPosition.X, TextboxPosition.Y + 48), Color.DarkRed) - End If - Case 4 - Core.SpriteBatch.DrawString(FontManager.MainFont, Localization.GetString("new_game_select_skin") & ":" & Environment.NewLine & skinNames(SkinIndex) & Environment.NewLine & Localization.GetString("global_" & skinGenders(SkinIndex).ToLower(), skinGenders(SkinIndex)), New Vector2(TextboxPosition.X + 2, TextboxPosition.Y - 24 + 2), Color.Black) - Core.SpriteBatch.DrawString(FontManager.MainFont, Localization.GetString("new_game_select_skin") & ":" & Environment.NewLine & skinNames(SkinIndex) & Environment.NewLine & Localization.GetString("global_" & skinGenders(SkinIndex).ToLower(), skinGenders(SkinIndex)), New Vector2(TextboxPosition.X, TextboxPosition.Y - 24), Color.White) - - Canvas.DrawScrollBar(New Vector2(TextboxPosition.X, TextboxPosition.Y + 48), skinFiles.Count, 1, SkinIndex, New Size(128, 4), True, TextureManager.GetTexture(TextureManager.GetTexture("GUI\Menus\Menu"), New Rectangle(112, 12, 1, 1)), TextureManager.GetTexture(TextureManager.GetTexture("GUI\Menus\Menu"), New Rectangle(113, 12, 1, 1))) - End Select - End Sub - - Private Sub DrawTextBox() - Canvas.DrawRectangle(New Rectangle(CInt(Core.windowSize.Width / 2) - 74, CInt(Core.windowSize.Height / 2) + 124, 148, 32), New Color(101, 142, 255)) - Canvas.DrawRectangle(New Rectangle(CInt(Core.windowSize.Width / 2) - 70, CInt(Core.windowSize.Height / 2) + 128, 140, 24), Color.White) - - Dim t As String = Me.CurrentText - If t.Length < 14 Then - t &= "_" - End If - Core.SpriteBatch.DrawString(FontManager.MiniFont, t, TextboxPosition(), Color.Black) - - Dim l As New Dictionary(Of Buttons, String) - l.Add(Buttons.A, "Accept") - l.Add(Buttons.X, "Edit name") - Me.DrawGamePadControls(l) - End Sub - - Private Function TextboxPosition() As Vector2 - Return New Vector2(CInt(Core.windowSize.Width / 2) - 70, CInt(Core.windowSize.Height / 2) + 128) - End Function - - Private Sub UpdatePokemon() - Select Case pokeIndex - Case 0 - ballPosition = New Vector2(CInt(Core.windowSize.Width / 2) - 40, CInt(Core.windowSize.Height / 2) - 110) - pokePosition = New Vector2(CInt(Core.windowSize.Width / 2) - 200, CInt(Core.windowSize.Height / 2) - 110) - pokeIndex = 1 - AnimateBall() - Case 1 - If ballPosition.X > CInt(Core.windowSize.Width / 2) - 200 Then - ballPosition.X -= 3 - ballPosition.Y += ballVelocity - ballVelocity += 0.2F - Else - pokeIndex = 2 - End If - AnimateBall() - Case 2 - If pokePosition.Y < CInt(Core.windowSize.Height / 2) Then - pokePosition.Y += 5 - Else - Dim p As Pokemon = Pokemon.GetPokemonByID(pokeID) - p.PlayCry() - pokeIndex = 3 - Index = 2 - End If - End Select - End Sub - - Private Sub AnimateBall() - If ballAnimationDelay <= 0.0F Then - ballIndex.X += 1 - If ballIndex.X = 2 And ballIndex.Y = 2 Then - ballIndex = New Vector2(0, 0) - End If - If ballIndex.X = 2 Then - ballIndex.X = 0 - ballIndex.Y += 1 - End If - ballAnimationDelay = 0.2F - Else - ballAnimationDelay -= 0.1F - End If - End Sub - - Private Sub UpdateTransition(ByVal ToProf As Boolean) - If ToProf = True Then - If OtherAlpha > 0 Then - OtherAlpha -= 5 - End If - If OtherAlpha <= 0 Then - If ProfAlpha < 255 Then - ProfAlpha += 5 - - If ProfAlpha >= 255 Then - Index += 1 - End If - End If - End If - Else - If ProfAlpha > 0 Then - ProfAlpha -= 5 - End If - If ProfAlpha <= 0 Then - If OtherAlpha < 255 Then - OtherAlpha += 5 - - If OtherAlpha >= 255 Then - Index += 1 - End If - End If - End If - End If - End Sub - - Private Sub UpdateChooseSkin() - Dim sIndex As Integer = SkinIndex - If Controls.Right(True, True, True, True) = True Then - SkinIndex += 1 - End If - If Controls.Left(True, True, True, True) = True Then - SkinIndex -= 1 - End If - - SkinIndex = CInt(MathHelper.Clamp(SkinIndex, 0, skinFiles.Count - 1)) - Dim skinTexture2D = TextureManager.GetTexture("Textures\NPC\" & skinFiles(SkinIndex)) - Dim skinRectangle As New Rectangle(0, CInt(skinTexture2D.Height / 4 * 2), CInt(skinTexture2D.Width / 3), CInt(skinTexture2D.Height / 4)) - If sIndex <> SkinIndex Then + TextBox.Showing = False + Me.Index = 0 + TextBox.reDelay = 0 + Dim skinTexture2D = TextureManager.GetTexture("Textures\NPC\" & skinFiles(SkinIndex)) + Dim skinRectangle As New Rectangle(0, CInt(skinTexture2D.Height / 4 * 2), CInt(skinTexture2D.Width / 3), CInt(skinTexture2D.Height / 4)) skinTexture = TextureManager.GetTexture(skinTexture2D, skinRectangle) - End If - If Controls.Accept() = True Then - Index += 1 - End If - End Sub + MusicManager.Play("nomusic") + End Sub - Private Sub UpdateTextbox() - CanMuteAudio = False + Private Sub LoadIntroValues() + Dim GameMode As GameMode = GameModeManager.ActiveGameMode - If ControllerHandler.ButtonPressed(Buttons.X) = True Then - Core.SetScreen(New InputScreen(Core.CurrentScreen, "Player", InputScreen.InputModes.Name, Me.CurrentText, 14, {TextureManager.GetTexture(TextureManager.GetTexture("Textures\NPC\" & skinFiles(SkinIndex)), New Rectangle(0, 64, 32, 32))}.ToList(), AddressOf Me.ConfirmInput)) - Else - KeyBindings.GetNameInput(Me.CurrentText, 14) + Me.skinNames = GameMode.SkinNames.ToArray() + Me.skinFiles = GameMode.SkinFiles.ToArray() + Me.skinGenders = GameMode.SkinGenders.ToArray() + Me.skinColors = GameMode.SkinColors - Me.CurrentText = CorrectChars(Me.CurrentText) + Me.pokemonRange = GameMode.PokemonRange + Me.introMusic = GameMode.IntroMusic + Me.startMap = GameMode.StartMap + Me.startPosition = GameMode.StartPosition + Me.startLocation = GameMode.StartLocationName + Me.startYaw = GameMode.StartRotation + Me.normalColor = GameMode.StartColor + Me.currentBackColor = GameMode.StartColor - If Controls.Accept(False, True, True) = True And KeyBoardHandler.KeyPressed(Keys.Space) = False Then - If CurrentText.Length > 2 And String.IsNullOrWhiteSpace(CurrentText) = False Then - Me.Name = CurrentText - Index += 1 - Else - enterCorrectName = True + If GameMode.StartDialogue <> "" Then + If GameMode.StartDialogue.CountSplits("|") >= 3 Then + Dim Splits() As String = GameMode.StartDialogue.Split(CChar("|")) + Me.Dialogues.AddRange(Splits) + End If + Else + If Me.Dialogues.Count < 3 Then + Me.Dialogues.Clear() + Me.Dialogues.AddRange({Localization.GetString("new_game_intro_1"), Localization.GetString("new_game_intro_2"), Localization.GetString("new_game_intro_3")}) End If End If - End If - End Sub + End Sub - Private Sub ConfirmInput(ByVal input As String) - Me.CurrentText = CorrectChars(input) - End Sub - - Private Function CorrectChars(ByVal t As String) As String - Dim exclude() As String = {"\", "/", ":", "*", "?", """", "<", ">", "|", ",", "."} - Dim s As String = "" - For Each c As Char In t - If exclude.Contains(c.ToString()) = True Then - c = CChar(" ") - End If - s &= c.ToString() - Next - Return s - End Function - - Private Sub CreateGame() - Dim folderPath As String = Name - Dim folderPrefix As Integer = 0 - - If folderPath.ToLower() = "autosave" Then - folderPath = "autosave0" - End If - - Dim savePath As String = GameController.GamePath & "\Save\" - - While System.IO.Directory.Exists(savePath & folderPath) = True - If folderPath <> Name Then - folderPath = folderPath.Remove(folderPath.Length - folderPrefix.ToString().Length, folderPrefix.ToString().Length) + Public Overrides Sub Update() + If Index = 5 Then + Core.GameInstance.IsMouseVisible = True + Else + Core.GameInstance.IsMouseVisible = False End If - folderPath &= folderPrefix + If ProfAlpha < 255 And Index = 0 Then + ProfAlpha += 2 + If ProfAlpha >= 255 Then + MusicManager.Play(Me.introMusic, True, 0.0F) + End If + ElseIf ProfAlpha >= 255 Or Index > 0 Then + TextBox.Update() - folderPrefix += 1 - End While + If TextBox.Showing = False Then + Select Case Index + Case 1 + UpdatePokemon() + Case 3 + UpdateTransition(False) + Case 4 + If Screens.MainMenu.NewNewGameScreen.CharacterSelectionScreen.SelectedSkin <> "" Then + skinTexture = TextureManager.GetTexture(Screens.MainMenu.NewNewGameScreen.CharacterSelectionScreen.SelectedSkin) + Index += 1 + Else + SetScreen(New Screens.MainMenu.NewNewGameScreen.CharacterSelectionScreen(CurrentScreen)) + End If + Case 5 + UpdateTextbox() + Case 7 + UpdateTransition(True) + Case 9 + If ProfAlpha > 0 Then + ProfAlpha -= 2 + End If + If ProfAlpha <= 0 Then + CreateGame() + End If + Case Else + ShowText() + End Select + End If + End If - If System.IO.Directory.Exists(GameController.GamePath & "\Save") = False Then - System.IO.Directory.CreateDirectory(GameController.GamePath & "\Save") - End If + Dim AimColor As Color = normalColor - System.IO.Directory.CreateDirectory(savePath & folderPath) + If Me.Index = 4 Then + AimColor = skinColors(SkinIndex) + End If - System.IO.File.WriteAllText(savePath & folderPath & "\Player.dat", GetPlayerData()) - System.IO.File.WriteAllText(savePath & folderPath & "\Pokedex.dat", "") - System.IO.File.WriteAllText(savePath & folderPath & "\Items.dat", "") - System.IO.File.WriteAllText(savePath & folderPath & "\Register.dat", "") - System.IO.File.WriteAllText(savePath & folderPath & "\Berries.dat", GetBerryData()) - System.IO.File.WriteAllText(savePath & folderPath & "\Apricorns.dat", "") - System.IO.File.WriteAllText(savePath & folderPath & "\Daycare.dat", "") - System.IO.File.WriteAllText(savePath & folderPath & "\Party.dat", "") - System.IO.File.WriteAllText(savePath & folderPath & "\ItemData.dat", "") - System.IO.File.WriteAllText(savePath & folderPath & "\Options.dat", GetOptionsData()) - System.IO.File.WriteAllText(savePath & folderPath & "\Box.dat", "") - System.IO.File.WriteAllText(savePath & folderPath & "\NPC.dat", "") - System.IO.File.WriteAllText(savePath & folderPath & "\HallOfFame.dat", "") - System.IO.File.WriteAllText(savePath & folderPath & "\SecretBase.dat", "") - System.IO.File.WriteAllText(savePath & folderPath & "\RoamingPokemon.dat", "") - System.IO.File.WriteAllText(savePath & folderPath & "\Statistics.dat", "") + Dim diffR As Byte = 5 + If (CInt(currentBackColor.R) - CInt(AimColor.R)).ToPositive() < 5 Then + diffR = 1 + End If + Dim diffG As Byte = 5 + If (CInt(currentBackColor.G) - CInt(AimColor.G)).ToPositive() < 5 Then + diffG = 1 + End If + Dim diffB As Byte = 5 + If (CInt(currentBackColor.B) - CInt(AimColor.B)).ToPositive() < 5 Then + diffB = 1 + End If + If currentBackColor.R < AimColor.R Then + currentBackColor.R += diffR + ElseIf currentBackColor.R > AimColor.R Then + currentBackColor.R -= diffR + End If + If currentBackColor.G < AimColor.G Then + currentBackColor.G += diffG + ElseIf currentBackColor.G > AimColor.G Then + currentBackColor.G -= diffG + End If + If currentBackColor.B < AimColor.B Then + currentBackColor.B += diffB + ElseIf currentBackColor.B > AimColor.B Then + currentBackColor.B -= diffB + End If + End Sub - Core.Player.IsGameJoltSave = False - Core.Player.LoadGame(folderPath) - Core.SetScreen(New TransitionScreen(Me, New OverworldScreen(), Color.Black, False, 5)) - End Sub + Private Sub ShowText() + Dim Text As String = "" - Private Function GetPlayerData() As String - Dim ot As String = Core.Random.Next(0, 65256).ToString() - While ot.Length < 5 - ot = "0" & ot - End While + Select Case Index + Case 0 + Text = Dialogues(0) + Case 2 + Text = Dialogues(1) + Case 6 + Text = NameReaction(Name) + Case 8 + Text = Name & Dialogues(2) + End Select - Dim s As String = "Name|" & Name & Environment.NewLine & + TextBox.reDelay = 0 + TextBox.Show(Text, {}) + + Index += 1 + End Sub + + + Public Overrides Sub Draw() + Canvas.DrawRectangle(New Rectangle(0, 0, Core.windowSize.Width, Core.windowSize.Height), currentBackColor) + + TextBox.Draw() + + Core.SpriteBatch.Draw(mainTexture, New Rectangle(CInt(Core.windowSize.Width / 2) - 62, CInt(Core.windowSize.Height / 2) - 218, 130, 256), New Rectangle(0, 0, 62, 128), New Color(255, 255, 255, ProfAlpha)) + + Select Case pokeIndex + Case 1 + Core.SpriteBatch.Draw(mainTexture, New Rectangle(CInt(ballPosition.X), CInt(ballPosition.Y), 22, 22), New Rectangle(62 + CInt(ballIndex.X * 22), 48 + CInt(ballIndex.Y * 22), 22, 22), Color.White) + Case 2 + Core.SpriteBatch.Draw(pokeTexture, New Rectangle(CInt(pokePosition.X) - 100, CInt(pokePosition.Y) - 218, 256, 256), Color.White) + Case 3 + If Index < 6 Then + Core.SpriteBatch.Draw(pokeTexture, New Rectangle(CInt(Core.windowSize.Width / 2) - 300, CInt(Core.windowSize.Height / 2) - 218, 256, 256), New Color(255, 255, 255, ProfAlpha)) + End If + End Select + + End Sub + + Private Sub UpdatePokemon() + Select Case pokeIndex + Case 0 + ballPosition = New Vector2(CInt(Core.windowSize.Width / 2) - 40, CInt(Core.windowSize.Height / 2) - 110) + pokePosition = New Vector2(CInt(Core.windowSize.Width / 2) - 200, CInt(Core.windowSize.Height / 2) - 110) + pokeIndex = 1 + AnimateBall() + Case 1 + If ballPosition.X > CInt(Core.windowSize.Width / 2) - 200 Then + ballPosition.X -= 3 + ballPosition.Y += ballVelocity + ballVelocity += 0.2F + Else + pokeIndex = 2 + End If + AnimateBall() + Case 2 + If pokePosition.Y < CInt(Core.windowSize.Height / 2) Then + pokePosition.Y += 5 + Else + Dim p As Pokemon = Pokemon.GetPokemonByID(pokeID) + p.PlayCry() + pokeIndex = 3 + Index = 2 + End If + End Select + End Sub + + Private Sub AnimateBall() + If ballAnimationDelay <= 0.0F Then + ballIndex.X += 1 + If ballIndex.X = 2 And ballIndex.Y = 2 Then + ballIndex = New Vector2(0, 0) + End If + If ballIndex.X = 2 Then + ballIndex.X = 0 + ballIndex.Y += 1 + End If + ballAnimationDelay = 0.2F + Else + ballAnimationDelay -= 0.1F + End If + End Sub + + Private Sub UpdateTransition(ByVal ToProf As Boolean) + If ToProf = True Then + If OtherAlpha > 0 Then + OtherAlpha -= 5 + End If + If OtherAlpha <= 0 Then + If ProfAlpha < 255 Then + ProfAlpha += 5 + + If ProfAlpha >= 255 Then + Index += 1 + End If + End If + End If + Else + If ProfAlpha > 0 Then + ProfAlpha -= 5 + End If + If ProfAlpha <= 0 Then + If OtherAlpha < 255 Then + OtherAlpha += 5 + + If OtherAlpha >= 255 Then + Index += 1 + End If + End If + End If + End If + End Sub + + Private Sub UpdateTextbox() + Dim skinTexture2D As Texture2D = TextureManager.GetTexture("Textures\NPC\" & skinFiles(SkinIndex)) + Core.SetScreen(New InputScreen(Core.CurrentScreen, Screens.MainMenu.NewNewGameScreen.CharacterSelectionScreen.SelectedSkin, InputScreen.InputModes.Name, Screens.MainMenu.NewNewGameScreen.CharacterSelectionScreen.SelectedSkin, 14, New List(Of Texture2D), AddressOf Me.ConfirmInput)) + End Sub + + Private Sub ConfirmInput(ByVal input As String) + Me.CurrentText = input + End Sub + + Private Sub CreateGame() + Dim folderPath As String = Name.Replace("\", "_").Replace("/", "_").Replace(":", "_").Replace("*", "_").Replace("?", "_").Replace("""", "_").Replace("<", "_").Replace(">", "_").Replace("|", "_").Replace(",", "_").Replace(".", "_") + Dim folderPrefix As Integer = 0 + + If folderPath.ToLower() = "autosave" Then + folderPath = "autosave0" + End If + + Dim savePath As String = GameController.GamePath & "\Save\" + + While System.IO.Directory.Exists(savePath & folderPath) = True + If folderPath <> Name Then + folderPath = folderPath.Remove(folderPath.Length - folderPrefix.ToString().Length, folderPrefix.ToString().Length) + End If + + folderPath &= folderPrefix + + folderPrefix += 1 + End While + + If System.IO.Directory.Exists(GameController.GamePath & "\Save") = False Then + System.IO.Directory.CreateDirectory(GameController.GamePath & "\Save") + End If + + System.IO.Directory.CreateDirectory(savePath & folderPath) + + System.IO.File.WriteAllText(savePath & folderPath & "\Player.dat", GetPlayerData()) + System.IO.File.WriteAllText(savePath & folderPath & "\Pokedex.dat", "") + System.IO.File.WriteAllText(savePath & folderPath & "\Items.dat", "") + System.IO.File.WriteAllText(savePath & folderPath & "\Register.dat", "") + System.IO.File.WriteAllText(savePath & folderPath & "\Berries.dat", GetBerryData()) + System.IO.File.WriteAllText(savePath & folderPath & "\Apricorns.dat", "") + System.IO.File.WriteAllText(savePath & folderPath & "\Daycare.dat", "") + System.IO.File.WriteAllText(savePath & folderPath & "\Party.dat", "") + System.IO.File.WriteAllText(savePath & folderPath & "\ItemData.dat", "") + System.IO.File.WriteAllText(savePath & folderPath & "\Options.dat", GetOptionsData()) + System.IO.File.WriteAllText(savePath & folderPath & "\Box.dat", "") + System.IO.File.WriteAllText(savePath & folderPath & "\NPC.dat", "") + System.IO.File.WriteAllText(savePath & folderPath & "\HallOfFame.dat", "") + System.IO.File.WriteAllText(savePath & folderPath & "\SecretBase.dat", "") + System.IO.File.WriteAllText(savePath & folderPath & "\RoamingPokemon.dat", "") + System.IO.File.WriteAllText(savePath & folderPath & "\Statistics.dat", "") + + Core.Player.IsGameJoltSave = False + Core.Player.LoadGame(folderPath) + Core.SetScreen(New TransitionScreen(Me, New OverworldScreen(), Color.Black, False, 5)) + End Sub + + Private Function GetPlayerData() As String + Dim ot As String = Core.Random.Next(0, 65256).ToString() + While ot.Length < 5 + ot = "0" & ot + End While + + Dim s As String = "Name|" & Name & Environment.NewLine & "Position|" & Me.startPosition.X.ToString().Replace(GameController.DecSeparator, ".") & "," & Me.startPosition.Y.ToString().Replace(GameController.DecSeparator, ".") & "," & Me.startPosition.Z.ToString().Replace(GameController.DecSeparator, ".") & Environment.NewLine & "MapFile|" & Me.startMap & Environment.NewLine & "Rotation|" & Me.startYaw.ToString() & Environment.NewLine & @@ -470,14 +391,14 @@ "thirdPerson|0" & Environment.NewLine & "skin|" & skinFiles(SkinIndex) & Environment.NewLine & "location|" & Me.startLocation & Environment.NewLine & - "battleAnimations|2" & Environment.NewLine & + "battleAnimations|1" & Environment.NewLine & "BoxAmount|5" & Environment.NewLine & - "LastRestPlace|yourroom.dat" & Environment.NewLine & - "LastRestPlacePosition|1,0.1,3" & Environment.NewLine & + "LastRestPlace|" & startMap & Environment.NewLine & + "LastRestPlacePosition|" & Me.startPosition.X.ToString().Replace(GameController.DecSeparator, ".") & "," & Me.startPosition.Y.ToString().Replace(GameController.DecSeparator, ".") & "," & Me.startPosition.Z.ToString().Replace(GameController.DecSeparator, ".") & Environment.NewLine & "DiagonalMovement|0" & Environment.NewLine & "RepelSteps|0" & Environment.NewLine & - "LastSavePlace|yourroom.dat" & Environment.NewLine & - "LastSavePlacePosition|1,0.1,3" & Environment.NewLine & + "LastSavePlace|" & startMap & Environment.NewLine & + "LastSavePlacePosition|" & Me.startPosition.X.ToString().Replace(GameController.DecSeparator, ".") & "," & Me.startPosition.Y.ToString().Replace(GameController.DecSeparator, ".") & "," & Me.startPosition.Z.ToString().Replace(GameController.DecSeparator, ".") & Environment.NewLine & "Difficulty|" & GameModeManager.GetGameRuleValue("Difficulty", "0") & Environment.NewLine & "BattleStyle|0" & Environment.NewLine & "saveCreated|" & GameController.GAMEDEVELOPMENTSTAGE & " " & GameController.GAMEVERSION & Environment.NewLine & @@ -485,26 +406,26 @@ "DaycareSteps|0" & Environment.NewLine & "GameMode|" & GameModeManager.ActiveGameMode.DirectoryName & Environment.NewLine & "PokeFiles|" & Environment.NewLine & - "VisitedMaps|yourroom.dat" & Environment.NewLine & - "TempSurfSkin|Hilbert" & Environment.NewLine & + "VisitedMaps|" & startMap & Environment.NewLine & + "TempSurfSkin|" & skinFiles(SkinIndex) & Environment.NewLine & "Surfing|0" & Environment.NewLine & "ShowModels|1" & Environment.NewLine & "GTSStars|4" & Environment.NewLine & "SandBoxMode|0" - Return s - End Function + Return s + End Function - Public Shared Function GetOptionsData() As String - Dim s As String = "FOV|50" & Environment.NewLine & + Public Shared Function GetOptionsData() As String + Dim s As String = "FOV|50" & Environment.NewLine & "TextSpeed|2" & Environment.NewLine & "MouseSpeed|12" - Return s - End Function + Return s + End Function - Public Shared Function GetBerryData() As String - Dim s As String = "{route29.dat|13,0,5|6|2|0|2012,9,21,4,0,0|1}" & Environment.NewLine & + Public Shared Function GetBerryData() As String + Dim s As String = "{route29.dat|13,0,5|6|2|0|2012,9,21,4,0,0|1}" & Environment.NewLine & "{route29.dat|14,0,5|6|2|0|2012,9,21,4,0,0|1}" & Environment.NewLine & "{route29.dat|15,0,5|6|2|0|2012,9,21,4,0,0|1}" & Environment.NewLine & "{azalea.dat|9,0,3|0|2|0|2012,9,21,4,0,0|1}" & Environment.NewLine & @@ -531,23 +452,25 @@ "{safarizone\main.dat|4,0,11|0|2|0|2012,9,21,4,0,0|1}" & Environment.NewLine & "{safarizone\main.dat|5,0,11|6|3|0|2012,9,21,4,0,0|1}" - Return s - End Function + Return s + End Function - Private Function NameReaction(ByVal name As String) As String - Dim WeirdNames() As String = {"derp", "karp"} - Dim KnownNames() As String = {"ash", "gary", "misty", "brock", "tracey", "may", "max", "dawn", "iris", "cilan", "red", "blue", "green", "gold", "silver"} - Dim OwnNames() As String = {"oak", "samuel", "prof. oak", "prof oak"} + Private Function NameReaction(ByVal name As String) As String + Dim WeirdNames() As String = {"derp", "karp"} + Dim KnownNames() As String = {"ash", "gary", "misty", "brock", "tracey", "may", "max", "dawn", "iris", "cilan", "red", "blue", "green", "gold", "silver"} + Dim OwnNames() As String = {"oak", "samuel", "prof. oak", "prof oak"} - Select Case True - Case WeirdNames.Contains(name.ToLower()) - Return Localization.GetString("new_game_intro_weird_name_1") & name & Localization.GetString("new_game_intro_weird_name_2") - Case KnownNames.Contains(name.ToLower()) - Return Localization.GetString("new_game_intro_known_name_1") & name & Localization.GetString("new_game_intro_known_name_2") - Case OwnNames.Contains(name.ToLower()) - Return Localization.GetString("new_game_intro_same_name_1") & name & Localization.GetString("new_game_intro_same_name_2") - End Select + Select Case True + Case WeirdNames.Contains(name.ToLower()) + Return Localization.GetString("new_game_intro_weird_name_1") & name & Localization.GetString("new_game_intro_weird_name_2") + Case KnownNames.Contains(name.ToLower()) + Return Localization.GetString("new_game_intro_known_name_1") & name & Localization.GetString("new_game_intro_known_name_2") + Case OwnNames.Contains(name.ToLower()) + Return Localization.GetString("new_game_intro_same_name_1") & name & Localization.GetString("new_game_intro_same_name_2") + End Select - Return Localization.GetString("new_game_intro_name_1") & name & Localization.GetString("new_game_intro_name_2") - End Function -End Class \ No newline at end of file + Return Localization.GetString("new_game_intro_name_1") & name & Localization.GetString("new_game_intro_name_2") + End Function + + End Class +End Namespace \ No newline at end of file