DayTime, Level & PlayerSkin improvements

* Changed the DayTime enum name to DayTimes for consistency with other enums like Seasons
* Changing the EnvironmentType or WeatherType will now not reset back to the default when Reloading a map with the R key (Warping or loading a different map normally does reset those properties)
* @level.setdaytime(int) is now @environment.setdaytime(int), which sets the DayTime permanently across maps. Setting the daytime to any other value than 1 2 3 or 4 will reset the daytime to the default one
* Added command @player.setskin(name) which will permanently change the player's skin, unlike @player.wearskin(name) which only changes the skin temporarily.
This commit is contained in:
JappaWakka 2022-02-17 13:46:15 +01:00
parent 0c7600e4f4
commit 2c7fbf8364
11 changed files with 138 additions and 115 deletions

View File

@ -427,7 +427,7 @@
r = New ReactionContainer("<name> is looking~up at the sky.", MessageBulb.NotifcationTypes.Waiting)
End If
Case 27
If IsOutside() = True And World.GetTime() = World.DayTime.Night And World.GetCurrentRegionWeather() = World.Weathers.Clear Then
If IsOutside() = True And World.GetTime() = World.DayTimes.Night And World.GetCurrentRegionWeather() = World.Weathers.Clear Then
r = New ReactionContainer("Your Pokémon is happily~gazing at the beautiful,~starry sky!", MessageBulb.NotifcationTypes.Waiting)
End If
Case 28
@ -437,7 +437,7 @@
r = New ReactionContainer("<name> is looking~up at the ceiling.", MessageBulb.NotifcationTypes.Note)
End If
Case 30
If IsOutside() = True And World.GetTime() = World.DayTime.Night Then
If IsOutside() = True And World.GetTime() = World.DayTimes.Night Then
r = New ReactionContainer("Your Pokémon is staring~spellbound at the night sky!", MessageBulb.NotifcationTypes.Friendly)
End If
Case 31

View File

@ -209,13 +209,13 @@
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\pokegear"), New Rectangle(CInt(startPos.X + 34 + FontManager.MiniFont.MeasureString(t2).X), CInt(startPos.Y + 8), 16, 16), New Rectangle(112, 112, 16, 16), Color.White)
End If
Select Case World.GetTime
Case World.DayTime.Night
Case World.DayTimes.Night
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\pokegear"), New Rectangle(CInt(startPos.X + width - FontManager.MiniFont.MeasureString(t).X - 34), CInt(startPos.Y + 6), 16, 16), New Rectangle(64, 112, 8, 8), Color.White)
Case World.DayTime.Morning
Case World.DayTimes.Morning
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\pokegear"), New Rectangle(CInt(startPos.X + width - FontManager.MiniFont.MeasureString(t).X - 34), CInt(startPos.Y + 6), 16, 16), New Rectangle(72, 112, 8, 8), Color.White)
Case World.DayTime.Day
Case World.DayTimes.Day
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\pokegear"), New Rectangle(CInt(startPos.X + width - FontManager.MiniFont.MeasureString(t).X - 34), CInt(startPos.Y + 6), 16, 16), New Rectangle(64, 120, 8, 8), Color.White)
Case World.DayTime.Evening
Case World.DayTimes.Evening
Core.SpriteBatch.Draw(TextureManager.GetTexture("GUI\Menus\pokegear"), New Rectangle(CInt(startPos.X + width - FontManager.MiniFont.MeasureString(t).X - 34), CInt(startPos.Y + 6), 16, 16), New Rectangle(72, 120, 8, 8), Color.White)
End Select
End Sub
@ -1541,7 +1541,7 @@
Public OverwriteMax As Decimal
Public Name As String = ""
Public Region As String = ""
Public DayTimes As New List(Of World.DayTime)
Public DayTimes As New List(Of World.DayTimes)
Public Expansions As New List(Of String)
Public Music As String = ""
Public Content As String = ""
@ -1576,7 +1576,7 @@
Dim lDayTimes() As String = data(4).Split(CChar(","))
For Each daytime As String In lDayTimes
If StringHelper.IsNumeric(daytime) = True Then
DayTimes.Add(CType(CInt(daytime), World.DayTime))
DayTimes.Add(CType(CInt(daytime), World.DayTimes))
End If
Next

View File

@ -72,25 +72,25 @@ Public Class PressStartScreen
Dim dayTime = World.GetTime
Select Case dayTime
Case World.DayTime.Morning
Case World.DayTimes.Morning
_fromColor = New Color(246, 170, 109)
_toColor = New Color(248, 248, 248)
_textColor = Color.Black
Case World.DayTime.Day
Case World.DayTimes.Day
_fromColor = New Color(120, 160, 248)
_toColor = New Color(248, 248, 248)
_textColor = Color.Black
Case World.DayTime.Evening
Case World.DayTimes.Evening
_fromColor = New Color(32, 64, 168)
_toColor = New Color(40, 80, 88)
_textColor = Color.White
Case World.DayTime.Night
Case World.DayTimes.Night
_fromColor = New Color(32, 64, 168)
_toColor = New Color(0, 0, 0)
_textColor = Color.White
End Select
If dayTime = World.DayTime.Day OrElse dayTime = World.DayTime.Morning Then
If dayTime = World.DayTimes.Day OrElse dayTime = World.DayTimes.Morning Then
Dim clouds = New Scene.Clouds()
clouds.LoadContent()
_entities.Add(clouds)
@ -787,7 +787,7 @@ Public Class NewMainMenuScreen
Dim fontColor As Color = Color.White
Dim dayTime = World.GetTime
If dayTime = World.DayTime.Day OrElse dayTime = World.DayTime.Morning Then
If dayTime = World.DayTimes.Day OrElse dayTime = World.DayTimes.Morning Then
fontColor = Color.Black
End If

View File

@ -50,6 +50,16 @@
End Select
Case "toggledarkness"
Screen.Level.IsDark = Not Screen.Level.IsDark
Case "setdaytime"
Dim daytime As Integer = int(argument)
If daytime > 0 AndAlso daytime <= 4 Then
World.setDaytime = CType(daytime, World.DayTimes)
Screen.Level.DayTime = daytime
Else
World.setDaytime = Nothing
Screen.Level.DayTime = World.GetTime
End If
IsReady = True
End Select
Screen.Level.World.Initialize(Screen.Level.EnvironmentType, Screen.Level.WeatherType)

View File

@ -69,9 +69,6 @@
Case "setsafari"
Screen.Level.IsSafariZone = CBool(argument)
IsReady = True
Case "setdaytime"
Screen.Level.DayTime = CInt(argument)
IsReady = True
End Select
End Sub

View File

@ -41,6 +41,15 @@
.UpdateEntity()
End With
IsReady = True
Case "setskin"
Core.Player.Skin = argument
With Screen.Level.OwnPlayer
Dim TextureID As String = argument
.SetTexture(TextureID, False)
.UpdateEntity()
End With
IsReady = True
Case "move"
If Started = False Then
Screen.Camera.Move(sng(argument))

View File

@ -204,7 +204,6 @@ Namespace ScriptVersion2
r(New ScriptCommand("level", "waitforsave", "Makes the level idle until the current saving of an GameJolt save is done."))
r(New ScriptCommand("level", "reload", "Reloads the current map."))
r(New ScriptCommand("level", "setsafari", {New ScriptArgument("safari", ScriptArgument.ArgumentTypes.Bool)}.ToList(), "Sets if the current map is a Safari Zone (influences battle style)."))
r(New ScriptCommand("level", "setdaytime", {New ScriptArgument("daytime", ScriptArgument.ArgumentTypes.Int)}.ToList(), "Sets the daytime of the current map."))
' Constructs:
r(New ScriptCommand("level", "mapfile", "str", "Returns the mapfile of the currently loaded map.", ",", True))
r(New ScriptCommand("level", "levelfile", "str", "Returns the mapfile of the currently loaded map.", ",", True))
@ -406,7 +405,7 @@ Namespace ScriptVersion2
r(New ScriptCommand("environment", "setisdark", {New ScriptArgument("isDark", ScriptArgument.ArgumentTypes.Bool)}.ToList(), "Sets the ""IsDark"" parameter of the current map."))
r(New ScriptCommand("environment", "setrenderdistance", {New ScriptArgument("distance", ScriptArgument.ArgumentTypes.Str, {"0-4", "tiny", "small", "normal", "far", "extreme"})}.ToList(), "Sets the render distance."))
r(New ScriptCommand("environment", "toggledarkness", "Toggles the ""IsDark"" parameter of the current map."))
r(New ScriptCommand("environment", "setdaytime", {New ScriptArgument("daytime", ScriptArgument.ArgumentTypes.Int)}.ToList(), "Sets the daytime to use for the Outside EnvironmentType (0). Can be 1-4, any other number resets to the default daytime."))
' Constructs:
r(New ScriptCommand("environment", "daytime", "str", "Returns the current DayTime of the game.", ",", True))
r(New ScriptCommand("environment", "daytimeID", "int", "Returns the current DayTimeID of the game.", ",", True))
@ -440,7 +439,8 @@ Namespace ScriptVersion2
r(New ScriptCommand("player", "receivepokedex", "Makes the Pokédex accessible for the player."))
r(New ScriptCommand("player", "receivepokegear", "Makes the Pokégear accessible for the player."))
r(New ScriptCommand("player", "renamerival", "Opens the rival rename screen."))
r(New ScriptCommand("player", "wearskin", {New ScriptArgument("skin", ScriptArgument.ArgumentTypes.Str)}.ToList(), "Changes the player skin."))
r(New ScriptCommand("player", "wearskin", {New ScriptArgument("skin", ScriptArgument.ArgumentTypes.Str)}.ToList(), "Changes the player skin temporarily."))
r(New ScriptCommand("player", "setskin", {New ScriptArgument("skin", ScriptArgument.ArgumentTypes.Str)}.ToList(), "Changes the player skin permanently."))
r(New ScriptCommand("player", "setonlineskin", {New ScriptArgument("gamejoltID", ScriptArgument.ArgumentTypes.Str)}.ToList(), "Changes the player skin to a skin downloaded for the GameJoltID."))
r(New ScriptCommand("player", "move", {New ScriptArgument("steps", ScriptArgument.ArgumentTypes.Sng)}.ToList(), "Starts the player movement."))
r(New ScriptCommand("player", "moveasync", {New ScriptArgument("steps", ScriptArgument.ArgumentTypes.Str)}.ToList(), "Starts the async player movement."))

View File

@ -39,7 +39,7 @@ Public Class Level
Private _canFly As Boolean = False
Private _rideType As Integer = 0
Private _weatherType As Integer = 0
Public _DayTime As World.DayTime = World.GetTime
Public _DayTime As World.DayTimes = World.GetTime
Private _environmentType As Integer = 0
Private _wildPokemonGrass As Boolean = True
Private _wildPokemonFloor As Boolean = False
@ -351,13 +351,13 @@ Public Class Level
Public Property DayTime As Integer
Get
Select Case Me._DayTime
Case World.DayTime.Day
Case World.DayTimes.Day
Return 1
Case World.DayTime.Night
Case World.DayTimes.Night
Return 2
Case World.DayTime.Morning
Case World.DayTimes.Morning
Return 3
Case World.DayTime.Evening
Case World.DayTimes.Evening
Return 4
Case Else
Return World.GetTime
@ -366,13 +366,13 @@ Public Class Level
Set(value As Integer)
Select Case value
Case 1
Me._DayTime = World.DayTime.Day
Me._DayTime = World.DayTimes.Day
Case 2
Me._DayTime = World.DayTime.Night
Me._DayTime = World.DayTimes.Night
Case 3
Me._DayTime = World.DayTime.Morning
Me._DayTime = World.DayTimes.Morning
Case 4
Me._DayTime = World.DayTime.Evening
Me._DayTime = World.DayTimes.Evening
Case Else
Me._DayTime = World.GetTime
End Select
@ -733,7 +733,7 @@ Public Class Level
''' Loads a level from a levelfile.
''' </summary>
''' <param name="Levelpath">The path to load the level from. Start with "|" to prevent loading a levelfile.</param>
Public Sub Load(ByVal Levelpath As String)
Public Sub Load(ByVal Levelpath As String, Optional Reload As Boolean = False)
' copy all changed files
If GameController.IS_DEBUG_ACTIVE Then
@ -750,7 +750,7 @@ Public Class Level
If Levelpath.StartsWith("|") = False Then
Me.StopOffsetMapUpdate()
Dim levelLoader As New LevelLoader()
levelLoader.LoadLevel(params.ToArray())
levelLoader.LoadLevel(params.ToArray(), Reload)
Else
Logger.Debug("Don't attempt to load a levelfile.")
End If
@ -829,7 +829,7 @@ Public Class Level
If KeyBoardHandler.KeyPressed(Keys.R) = True And Core.CurrentScreen.Identification = Screen.Identifications.OverworldScreen Then
Core.OffsetMaps.Clear()
Logger.Debug(String.Format("Reload map file: {0}", Me._levelFile))
Me.Load(LevelFile)
Me.Load(LevelFile, True)
End If
End If

View File

@ -4,6 +4,7 @@
Public Shared LoadedOffsetMapOffsets As New List(Of Vector3)
Public Shared LoadedOffsetMapNames As New List(Of String)
Private _reload As Boolean = False
Private Enum TagTypes
Entity
@ -46,10 +47,10 @@
''' Loads the level.
''' </summary>
''' <param name="Params">Params contruction: String LevelFile, bool IsOffsetMap, Vector3 Offset, int Offsetmaplevel, Str() InstanceLoadedOffsetMaps</param>
Public Sub LoadLevel(ByVal Params As Object())
Public Sub LoadLevel(ByVal Params As Object(), Optional Reload As Boolean = False)
Busy += 1
TempParams = Params
_reload = Reload
If MULTITHREAD = True Then
Dim t As New Threading.Thread(AddressOf InternalLoad)
t.IsBackground = True
@ -992,23 +993,24 @@
Else
Screen.Level.RideType = 0
End If
If _reload = False Then
If TagExists(Tags, "EnvironmentType") = True Then
Screen.Level.EnvironmentType = CInt(GetTag(Tags, "EnvironmentType"))
Else
Screen.Level.EnvironmentType = 0
End If
If TagExists(Tags, "EnvironmentType") = True Then
Screen.Level.EnvironmentType = CInt(GetTag(Tags, "EnvironmentType"))
Else
Screen.Level.EnvironmentType = 0
End If
If TagExists(Tags, "Weather") = True Then
Screen.Level.WeatherType = CInt(GetTag(Tags, "Weather"))
Else
Screen.Level.WeatherType = 0
End If
If TagExists(Tags, "Weather") = True Then
Screen.Level.WeatherType = CInt(GetTag(Tags, "Weather"))
Else
Screen.Level.WeatherType = 0
End If
If TagExists(Tags, "DayTime") = True Then
Screen.Level.DayTime = CInt(GetTag(Tags, "DayTime"))
Else
Screen.Level.DayTime = 0
If TagExists(Tags, "DayTime") = True Then
Screen.Level.DayTime = CInt(GetTag(Tags, "DayTime"))
Else
Screen.Level.DayTime = 0
End If
End If
If TagExists(Tags, "Lighting") = True Then
@ -1023,7 +1025,7 @@
Screen.Level.IsDark = False
End If
If Screen.Level.DayTime = World.DayTime.Night Then
If Screen.Level.DayTime = World.DayTimes.Night Then
If World.IsAurora = False Then
Dim chance = Random.Next(0, 250)
If chance = 0 Then

View File

@ -246,7 +246,7 @@
End Function
Private Function GetCloudsTexture() As Texture2D
Dim time As World.DayTime = World.GetTime
Dim time As World.DayTimes = World.GetTime
Select Case Screen.Level.World.CurrentMapWeather
Case World.Weathers.Rain, World.Weathers.Blizzard, World.Weathers.Thunderstorm, World.Weathers.Snow
@ -262,11 +262,11 @@
Case 4
Return TextureManager.GetTexture("SkyDomeResource\Clouds_Evening")
End Select
If time = World.DayTime.Morning Then
If time = World.DayTimes.Morning Then
Return TextureManager.GetTexture("SkyDomeResource\Clouds_Morning")
ElseIf time = World.DayTime.Day Then
ElseIf time = World.DayTimes.Day Then
Return TextureManager.GetTexture("SkyDomeResource\Clouds_Day")
ElseIf time = World.DayTime.Evening Then
ElseIf time = World.DayTimes.Evening Then
Return TextureManager.GetTexture("SkyDomeResource\Clouds_Evening")
Else
Return TextureManager.GetTexture("SkyDomeResource\Clouds_Night")
@ -288,14 +288,14 @@
Case 4
Return TextureManager.GetTexture("SkyDomeResource\Sky_Evening")
End Select
Dim time As World.DayTime = World.GetTime
Dim time As World.DayTimes = World.GetTime
Select Case Screen.Level.World.CurrentMapWeather
Case World.Weathers.Clear
If time = World.DayTime.Morning Then
If time = World.DayTimes.Morning Then
Return TextureManager.GetTexture("SkyDomeResource\Sky_Morning")
ElseIf time = World.DayTime.Day Then
ElseIf time = World.DayTimes.Day Then
Return TextureManager.GetTexture("SkyDomeResource\Sky_Day")
ElseIf time = World.DayTime.Evening Then
ElseIf time = World.DayTimes.Evening Then
Return TextureManager.GetTexture("SkyDomeResource\Sky_Evening")
Else
Return TextureManager.GetTexture("SkyDomeResource\Sky_Night")

View File

@ -5,6 +5,7 @@ Public Class World
Private Shared _regionWeather As Weathers = Weathers.Clear
Private Shared _regionWeatherSet As Boolean = False
Public Shared setSeason As Seasons = Nothing
Public Shared setDaytime As DayTimes = Nothing
Public Shared IsMainMenu As Boolean = False
Public Shared IsAurora As Boolean = False
@ -38,7 +39,7 @@ Public Class World
Forest = 5
End Enum
Public Enum DayTime As Integer
Public Enum DayTimes As Integer
Night = 0
Morning = 1
Day = 2
@ -78,64 +79,68 @@ Public Class World
End Get
End Property
Public Shared ReadOnly Property GetTime() As DayTime
Public Shared ReadOnly Property GetTime() As DayTimes
Get
If IsMainMenu Then
Return DayTime.Day
Return DayTimes.Day
End If
Dim time As DayTime = DayTime.Day
If setDaytime <> Nothing Then
Return setDaytime
Else
Dim time As DayTimes = DayTimes.Day
Dim Hour As Integer = My.Computer.Clock.LocalTime.Hour
If NeedServerObject() = True Then
Dim data() As String = ServerTimeData.Split(CChar(","))
Hour = CInt(data(0))
Dim Hour As Integer = My.Computer.Clock.LocalTime.Hour
If NeedServerObject() = True Then
Dim data() As String = ServerTimeData.Split(CChar(","))
Hour = CInt(data(0))
End If
Select Case CurrentSeason
Case Seasons.Winter
If Hour > 18 Or Hour < 7 Then
time = DayTimes.Night
ElseIf Hour > 6 And Hour < 11 Then
time = DayTimes.Morning
ElseIf Hour > 10 And Hour < 17 Then
time = DayTimes.Day
ElseIf Hour > 16 And Hour < 19 Then
time = DayTimes.Evening
End If
Case Seasons.Spring
If Hour > 19 Or Hour < 5 Then
time = DayTimes.Night
ElseIf Hour > 4 And Hour < 10 Then
time = DayTimes.Morning
ElseIf Hour > 9 And Hour < 17 Then
time = DayTimes.Day
ElseIf Hour > 16 And Hour < 20 Then
time = DayTimes.Evening
End If
Case Seasons.Summer
If Hour > 20 Or Hour < 4 Then
time = DayTimes.Night
ElseIf Hour > 3 And Hour < 9 Then
time = DayTimes.Morning
ElseIf Hour > 8 And Hour < 19 Then
time = DayTimes.Day
ElseIf Hour > 18 And Hour < 21 Then
time = DayTimes.Evening
End If
Case Seasons.Fall
If Hour > 19 Or Hour < 6 Then
time = DayTimes.Night
ElseIf Hour > 5 And Hour < 10 Then
time = DayTimes.Morning
ElseIf Hour > 9 And Hour < 18 Then
time = DayTimes.Day
ElseIf Hour > 17 And Hour < 20 Then
time = DayTimes.Evening
End If
End Select
Return time
End If
Select Case CurrentSeason
Case Seasons.Winter
If Hour > 18 Or Hour < 7 Then
time = DayTime.Night
ElseIf Hour > 6 And Hour < 11 Then
time = DayTime.Morning
ElseIf Hour > 10 And Hour < 17 Then
time = DayTime.Day
ElseIf Hour > 16 And Hour < 19 Then
time = DayTime.Evening
End If
Case Seasons.Spring
If Hour > 19 Or Hour < 5 Then
time = DayTime.Night
ElseIf Hour > 4 And Hour < 10 Then
time = DayTime.Morning
ElseIf Hour > 9 And Hour < 17 Then
time = DayTime.Day
ElseIf Hour > 16 And Hour < 20 Then
time = DayTime.Evening
End If
Case Seasons.Summer
If Hour > 20 Or Hour < 4 Then
time = DayTime.Night
ElseIf Hour > 3 And Hour < 9 Then
time = DayTime.Morning
ElseIf Hour > 8 And Hour < 19 Then
time = DayTime.Day
ElseIf Hour > 18 And Hour < 21 Then
time = DayTime.Evening
End If
Case Seasons.Fall
If Hour > 19 Or Hour < 6 Then
time = DayTime.Night
ElseIf Hour > 5 And Hour < 10 Then
time = DayTime.Morning
ElseIf Hour > 9 And Hour < 18 Then
time = DayTime.Day
ElseIf Hour > 17 And Hour < 20 Then
time = DayTime.Evening
End If
End Select
Return time
End Get
End Property
@ -223,7 +228,7 @@ Public Class World
End Select
Case EnvironmentTypes.Outside
Select Case World.GetTime
Case DayTime.Night
Case DayTimes.Night
Select Case Core.GameOptions.RenderDistance
Case 0
Screen.Effect.FogStart = -2
@ -251,7 +256,7 @@ Public Class World
Screen.Camera.FarPlane = 100
End Select
Case DayTime.Morning
Case DayTimes.Morning
Select Case Core.GameOptions.RenderDistance
Case 0
Screen.Effect.FogStart = 16
@ -279,7 +284,7 @@ Public Class World
Screen.Camera.FarPlane = 100
End Select
Case DayTime.Day
Case DayTimes.Day
Select Case Core.GameOptions.RenderDistance
Case 0
Screen.Effect.FogStart = 16
@ -307,7 +312,7 @@ Public Class World
Screen.Camera.FarPlane = 100
End Select
Case DayTime.Evening
Case DayTimes.Evening
Select Case Core.GameOptions.RenderDistance
Case 0
Screen.Effect.FogStart = 0