From 9e86665e5858507a4cb10df49325aae8f084276b Mon Sep 17 00:00:00 2001 From: JappaWakka Date: Mon, 29 Aug 2022 13:01:56 +0200 Subject: [PATCH] Added SaveOnly map tag A map tag that disables the PokeGear and all of the menu options except Save while on the map --- P3D/Overworld/OverworldScreen.vb | 2 +- P3D/Screens/NewMenuScreen.vb | 37 ++++++++++++++++++-------------- P3D/World/Level.vb | 13 +++++++++++ P3D/World/LevelLoader.vb | 5 +++++ 4 files changed, 40 insertions(+), 17 deletions(-) diff --git a/P3D/Overworld/OverworldScreen.vb b/P3D/Overworld/OverworldScreen.vb index c961f43bc..8fa29a76a 100644 --- a/P3D/Overworld/OverworldScreen.vb +++ b/P3D/Overworld/OverworldScreen.vb @@ -239,7 +239,7 @@ Public Class OverworldScreen NotificationPopupList(0).Dismiss() Else If Core.Player.HasPokegear = True Or GameController.IS_DEBUG_ACTIVE = True Or Core.Player.SandBoxMode = True Then - If Screen.Camera.IsMoving() = False And ActionScript.IsReady = True Then + If Screen.Camera.IsMoving() = False And ActionScript.IsReady = True AndAlso Screen.Level.SaveOnly = False Then Core.SetScreen(New GameJolt.PokegearScreen(Me, GameJolt.PokegearScreen.EntryModes.MainMenu, {})) End If End If diff --git a/P3D/Screens/NewMenuScreen.vb b/P3D/Screens/NewMenuScreen.vb index 7eb0aefbe..74b2416eb 100644 --- a/P3D/Screens/NewMenuScreen.vb +++ b/P3D/Screens/NewMenuScreen.vb @@ -42,25 +42,30 @@ End Sub Private Sub ConstructMenu() - If Core.Player.HasPokedex = True Then - _menuOptions.Add("Pokédex") - End If + If Screen.Level.SaveOnly = False Then - If Screen.Level.IsBugCatchingContest = True Then - _menuOptions.AddRange({Screen.Level.BugCatchingContestData.GetSplit(2) & " x" & Core.Player.Inventory.GetItemAmount(177), - "Bag", - "|||" & Core.Player.Name, 'Trainer card - "End Contest"}) - Else - If Core.Player.Pokemons.Count > 0 Then - _menuOptions.Add("Pokémon") + If Core.Player.HasPokedex = True Then + _menuOptions.Add("Pokédex") End If - _menuOptions.AddRange({"Bag", - "|||" & Core.Player.Name, - "Save"}) - End If - _menuOptions.Add("Options") + If Screen.Level.IsBugCatchingContest = True Then + _menuOptions.AddRange({Screen.Level.BugCatchingContestData.GetSplit(2) & " x" & Core.Player.Inventory.GetItemAmount(177), + "Bag", + "|||" & Core.Player.Name, 'Trainer card + "End Contest"}) + Else + If Core.Player.Pokemons.Count > 0 Then + _menuOptions.Add("Pokémon") + End If + _menuOptions.AddRange({"Bag", + "|||" & Core.Player.Name, + "Save"}) + End If + + _menuOptions.Add("Options") + Else + _menuOptions.Add("Save") + End If End Sub Private _blur As Resources.Blur.BlurHandler diff --git a/P3D/World/Level.vb b/P3D/World/Level.vb index 26a57e7aa..94a43fca9 100644 --- a/P3D/World/Level.vb +++ b/P3D/World/Level.vb @@ -41,6 +41,7 @@ Public Class Level Private _weatherType As Integer = 0 Public _DayTime As World.DayTimes = World.GetTime Private _environmentType As Integer = 0 + Private _saveonly As Boolean = False Private _wildPokemonGrass As Boolean = True Private _wildPokemonFloor As Boolean = False Private _wildPokemonWater As Boolean = True @@ -380,6 +381,18 @@ Public Class Level End Set End Property + ''' + ''' If only the Save option should be available in the menu for this map. + ''' + Public Property SaveOnly As Boolean + Get + Return Me._saveonly + End Get + Set(value As Boolean) + Me._saveonly = value + End Set + End Property + ''' ''' The environment type for this map. ''' diff --git a/P3D/World/LevelLoader.vb b/P3D/World/LevelLoader.vb index 2d8c7e1f7..fc7a13860 100644 --- a/P3D/World/LevelLoader.vb +++ b/P3D/World/LevelLoader.vb @@ -1009,6 +1009,11 @@ Else Screen.Level.RideType = 0 End If + If TagExists(Tags, "SaveOnly") = True Then + Screen.Level.SaveOnly = CBool(GetTag(Tags, "SaveOnly")) + Else + Screen.Level.SaveOnly = False + End If If _reload = False Then If TagExists(Tags, "EnvironmentType") = True Then Screen.Level.EnvironmentType = CInt(GetTag(Tags, "EnvironmentType"))