diff --git a/P3D.sln b/P3D.sln index 2d64286c1..cdbcb945b 100644 --- a/P3D.sln +++ b/P3D.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.27130.2026 +VisualStudioVersion = 15.0.27130.2036 MinimumVisualStudioVersion = 10.0.40219.1 Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "P3D", "P3D\P3D.vbproj", "{2AAF65BE-C81D-4663-ABF4-E2E09B16E12F}" EndProject @@ -19,6 +19,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TearUp", "lib\tools\TearUp\ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TearDown", "lib\tools\TearDown\TearDown.csproj", "{0AE314A4-6005-48C7-BCD4-33E4C5057CFD}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GameDevCommon", "lib\game-dev-common\src\GameDevCommon\GameDevCommon.csproj", "{087378EE-7591-47CE-979F-6824FC0606EF}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -75,6 +77,14 @@ Global {0AE314A4-6005-48C7-BCD4-33E4C5057CFD}.Release|Any CPU.Build.0 = Release|Any CPU {0AE314A4-6005-48C7-BCD4-33E4C5057CFD}.ReleaseNoContent|Any CPU.ActiveCfg = Release|Any CPU {0AE314A4-6005-48C7-BCD4-33E4C5057CFD}.ReleaseNoContent|Any CPU.Build.0 = Release|Any CPU + {087378EE-7591-47CE-979F-6824FC0606EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {087378EE-7591-47CE-979F-6824FC0606EF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {087378EE-7591-47CE-979F-6824FC0606EF}.DebugNoContent|Any CPU.ActiveCfg = Debug|Any CPU + {087378EE-7591-47CE-979F-6824FC0606EF}.DebugNoContent|Any CPU.Build.0 = Debug|Any CPU + {087378EE-7591-47CE-979F-6824FC0606EF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {087378EE-7591-47CE-979F-6824FC0606EF}.Release|Any CPU.Build.0 = Release|Any CPU + {087378EE-7591-47CE-979F-6824FC0606EF}.ReleaseNoContent|Any CPU.ActiveCfg = Release|Any CPU + {087378EE-7591-47CE-979F-6824FC0606EF}.ReleaseNoContent|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -86,6 +96,7 @@ Global {3B2AEA8E-4384-48D8-B26B-2C67466A1352} = {7877D883-AA51-4C27-ADA5-C4F85F86F4EE} {417FEA8A-9334-4938-9370-519EF1551B05} = {7877D883-AA51-4C27-ADA5-C4F85F86F4EE} {0AE314A4-6005-48C7-BCD4-33E4C5057CFD} = {7877D883-AA51-4C27-ADA5-C4F85F86F4EE} + {087378EE-7591-47CE-979F-6824FC0606EF} = {3CE8099E-129D-40F9-8D23-005DFF32E2A2} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {8FE3951F-DE18-41FF-A035-32DF597A91F2} diff --git a/P3D/Content/GUI/MainMenu/clouds.png b/P3D/Content/GUI/MainMenu/clouds.png new file mode 100644 index 000000000..374a0a7c2 Binary files /dev/null and b/P3D/Content/GUI/MainMenu/clouds.png differ diff --git a/P3D/Content/GUI/MainMenu/ground.png b/P3D/Content/GUI/MainMenu/ground.png new file mode 100644 index 000000000..473315332 Binary files /dev/null and b/P3D/Content/GUI/MainMenu/ground.png differ diff --git a/P3D/Content/GUI/MainMenu/hooh.png b/P3D/Content/GUI/MainMenu/hooh.png new file mode 100644 index 000000000..21ee36451 Binary files /dev/null and b/P3D/Content/GUI/MainMenu/hooh.png differ diff --git a/P3D/Content/GUI/MainMenu/hoohParticles.png b/P3D/Content/GUI/MainMenu/hoohParticles.png new file mode 100644 index 000000000..6df35bb50 Binary files /dev/null and b/P3D/Content/GUI/MainMenu/hoohParticles.png differ diff --git a/P3D/Content/GUI/MainMenu/lugia.png b/P3D/Content/GUI/MainMenu/lugia.png new file mode 100644 index 000000000..82f906c7a Binary files /dev/null and b/P3D/Content/GUI/MainMenu/lugia.png differ diff --git a/P3D/Content/GUI/MainMenu/lugiaParticle.png b/P3D/Content/GUI/MainMenu/lugiaParticle.png new file mode 100644 index 000000000..9eec47284 Binary files /dev/null and b/P3D/Content/GUI/MainMenu/lugiaParticle.png differ diff --git a/P3D/Core/GameController.vb b/P3D/Core/GameController.vb index fae74d864..df7137311 100644 --- a/P3D/Core/GameController.vb +++ b/P3D/Core/GameController.vb @@ -1,4 +1,5 @@ Imports System.Windows.Forms +Imports GameDevCommon ''' ''' Controls the game's main workflow. @@ -6,6 +7,7 @@ Public Class GameController Inherits Microsoft.Xna.Framework.Game + Implements IGame ''' ''' The current version of the game. @@ -50,6 +52,8 @@ Public Class GameController Public FPSMonitor As FPSMonitor Public Shared UpdateChecked As Boolean = False + Private _componentManager As ComponentManager + Public Sub New() Graphics = New GraphicsDeviceManager(Me) Content.RootDirectory = "Content" @@ -66,15 +70,18 @@ Public Class GameController If GameHacked = True Then Security.HackerAlerts.Activate() End If + + _componentManager = New ComponentManager() + GameInstanceProvider.SetInstance(Me) End Sub Protected Overrides Sub Initialize() + _componentManager.LoadComponents() Core.Initialize(Me) MyBase.Initialize() End Sub Protected Overrides Sub LoadContent() - End Sub Protected Overrides Sub UnloadContent() @@ -131,6 +138,14 @@ Public Class GameController NetworkPlayer.ScreenRegionChanged() End Sub + Public Function GetGame() As Game Implements IGame.GetGame + Return Me + End Function + + Public Function GetComponentManager() As ComponentManager Implements IGame.GetComponentManager + Return _componentManager + End Function + Private Shared GameHacked As Boolean = False 'Temp value that stores if a hacking file was detected at game start. ''' diff --git a/P3D/Overworld/OverworldCamera.vb b/P3D/Overworld/OverworldCamera.vb index 7e37a1560..b645b4aae 100644 --- a/P3D/Overworld/OverworldCamera.vb +++ b/P3D/Overworld/OverworldCamera.vb @@ -528,7 +528,7 @@ Public Class OverworldCamera If Core.GameOptions.ViewBobbing = False Then Return 0.0F End If - If Screen.Level.Riding = True Then + If Screen.Level?.Riding = True Then Return CSng(Math.Sin(_bobbingTemp) * 0.012) Else If Core.Player.IsRunning() = True Then diff --git a/P3D/P3D.vbproj b/P3D/P3D.vbproj index 34dac2fd3..4dfcb9375 100644 --- a/P3D/P3D.vbproj +++ b/P3D/P3D.vbproj @@ -11044,6 +11044,24 @@ PreserveNewest + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + PreserveNewest @@ -27452,11 +27470,19 @@ + + + + + + + + @@ -27557,6 +27583,12 @@ + + + {087378ee-7591-47ce-979f-6824fc0606ef} + GameDevCommon + + diff --git a/P3D/Player/Player.vb b/P3D/Player/Player.vb index fd0d0c724..424ad7938 100644 --- a/P3D/Player/Player.vb +++ b/P3D/Player/Player.vb @@ -723,7 +723,9 @@ Data = IO.File.ReadAllText(GameController.GamePath & "\Save\" & filePrefix & "\Player.dat").SplitAtNewline() End If - Screen.Level.Riding = False + If Not Screen.Level Is Nothing Then + Screen.Level.Riding = False + End If For Each Line As String In Data If Line <> "" And Line.Contains("|") = True Then @@ -848,7 +850,6 @@ TempSurfSkin = Value Case "surfing" startSurfing = CBool(Value) - Screen.Level.Surfing = CBool(Value) Case "bp" BP = CInt(Value) Case "gtsstars" @@ -867,7 +868,7 @@ End If Next - If IsGameJoltSave = True And Screen.Level.Surfing = False Then + If IsGameJoltSave = True And startSurfing = False Then Skin = GameJolt.Emblem.GetPlayerSpriteFile(GameJolt.Emblem.GetPlayerLevel(GameJoltSave.Points), GameJoltSave.GameJoltID, GameJoltSave.Gender) Select Case GameJoltSave.Gender Case "0" diff --git a/P3D/Screens/MainMenu/MainMenuEntity.vb b/P3D/Screens/MainMenu/MainMenuEntity.vb new file mode 100644 index 000000000..b67337391 --- /dev/null +++ b/P3D/Screens/MainMenu/MainMenuEntity.vb @@ -0,0 +1,25 @@ +Namespace Screens.MainMenu + + Public Class MainMenuEntity + + Inherits GameDevCommon.Rendering.Base3DObject(Of VertexPositionNormalTexture) + + Public Position As Vector3 + Public Rotation As Vector3 + Public ToBeRemoved As Boolean + + Public Sub New(position As Vector3) + Me.Position = position + Me.Rotation = Vector3.Zero + End Sub + + Protected Overrides Sub CreateWorld() + World = Matrix.CreateRotationX(Rotation.X) * + Matrix.CreateRotationY(Rotation.Y) * + Matrix.CreateRotationZ(Rotation.Z) * + Matrix.CreateTranslation(Position) + End Sub + + End Class + +End Namespace diff --git a/P3D/Screens/MainMenu/PressStartScreen.vb b/P3D/Screens/MainMenu/PressStartScreen.vb index 27de11d14..5261f00a9 100644 --- a/P3D/Screens/MainMenu/PressStartScreen.vb +++ b/P3D/Screens/MainMenu/PressStartScreen.vb @@ -1,4 +1,7 @@ -''' +Imports GameDevCommon.Drawing +Imports P3D.Screens.MainMenu + +''' ''' The "Press {BUTTON} to start" screen. ''' Public Class PressStartScreen @@ -9,8 +12,6 @@ Public Class PressStartScreen Private _introDelay As Single = 4.0F Private _logoFade As Single = 1.0F - 'Private _mainMenuMaps As DataModel.Json.Game.MainMenuMapModel() - Private _logoTexture As Texture2D = Nothing Private _shineTexture As Texture2D = Nothing @@ -20,6 +21,13 @@ Public Class PressStartScreen Private target As RenderTarget2D + Private _shader As GameDevCommon.Rendering.Shader + Private _entities As List(Of MainMenuEntity) = New List(Of MainMenuEntity)() + Private _camera As Screens.MainMenu.Scene.MainMenuCamera + Private _fromColor As Color + Private _toColor As Color + Private _textColor As Color + Dim tempF As Single = 0F Dim tempG As Single = 0F @@ -35,17 +43,7 @@ Public Class PressStartScreen GameModeManager.SetGameModePointer("Kolben") - Effect = New BasicEffect(GraphicsDevice) - Effect.FogEnabled = True - - SkyDome = New SkyDome() - Camera = New MainMenuCamera() - Core.Player.Skin = "Hilbert" - World.IsMainMenu = True - Level = New Level() - ChangeLevel() - Level.World.Initialize(Level.EnvironmentType, Level.WeatherType) If IO.Directory.Exists(GameController.GamePath & "\Save\") = False Then IO.Directory.CreateDirectory(GameController.GamePath & "\Save\") @@ -60,20 +58,71 @@ Public Class PressStartScreen _shineRenderer = New SpriteBatch(GraphicsDevice) _backgroundRenderer = New SpriteBatch(GraphicsDevice) - target = New RenderTarget2D(GraphicsDevice, windowSize.Width, windowSize.Height, False, SurfaceFormat.Color, DepthFormat.Depth24Stencil8) + target = New RenderTarget2D(GraphicsDevice, 1200, 680, False, SurfaceFormat.Color, DepthFormat.Depth24Stencil8) 'crappy fix Screens.MainMenu.NewNewGameScreen.CharacterSelectionScreen.SelectedSkin = "" Core.Player.Unload() + + _shader = New GameDevCommon.Rendering.BasicShader() + CType(_shader.Effect, BasicEffect).LightingEnabled = False + _camera = New Scene.MainMenuCamera() + + Dim dayTime = World.GetTime + + Select Case dayTime + Case World.DayTime.Morning + _fromColor = New Color(246, 170, 109) + _toColor = New Color(248, 248, 248) + _textColor = Color.Black + Case World.DayTime.Day + _fromColor = New Color(120, 160, 248) + _toColor = New Color(248, 248, 248) + _textColor = Color.Black + Case World.DayTime.Evening + _fromColor = New Color(32, 64, 168) + _toColor = New Color(40, 80, 88) + _textColor = Color.White + Case World.DayTime.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 + Dim clouds = New Scene.Clouds() + clouds.LoadContent() + _entities.Add(clouds) + + Dim hooh = New Scene.HoOh(_entities) + hooh.LoadContent() + _entities.Add(hooh) + Else + Dim ground = New Scene.Ground() + ground.LoadContent() + _entities.Add(ground) + + Dim lugia = New Scene.Lugia(_entities) + lugia.LoadContent() + _entities.Add(lugia) + End If + End Sub Public Overrides Sub Update() - Lighting.UpdateLighting(Effect) - Camera.Update() - Level.Update() - SkyDome.Update() - Level.World.Initialize(Level.EnvironmentType, Level.WeatherType) + For i = 0 To _entities.Count - 1 + If i < _entities.Count Then + _entities(i).Update() + If _entities(i).ToBeRemoved Then + _entities(i).Dispose() + _entities.RemoveAt(i) + i -= 1 + End If + End If + Next + + _camera.Update() If _introDelay > 0F Then _introDelay -= 0.1F @@ -112,20 +161,38 @@ Public Class PressStartScreen Public Overrides Sub Draw() If _blurHandler Is Nothing Then - _blurHandler = New Resources.Blur.BlurHandler(windowSize.Width, windowSize.Height) + _blurHandler = New Resources.Blur.BlurHandler(target.Width, target.Height) End If GraphicsDevice.SetRenderTarget(target) - GraphicsDevice.Clear(BackgroundColor) + GraphicsDevice.ResetFull() + GraphicsDevice.Clear(_fromColor) - SkyDome.Draw(45.0F) - Level.Draw() + + ' DRAW HERE + _backgroundRenderer.Begin() + + _backgroundRenderer.DrawGradient(New Rectangle(0, CType(target.Height / 2, Integer), target.Width, CType(target.Height / 4, Integer)), + _fromColor, _toColor, False, 1, 10) + _backgroundRenderer.DrawRectangle(New Rectangle(0, CType(target.Height / 4 * 3, Integer), target.Width, CType(target.Height / 4, Integer)), + _toColor) + + _backgroundRenderer.End() + + GraphicsDevice.ResetFull() + _shader.Prepare(_camera) + For Each entity In _entities + _shader.Render(entity) + Next GraphicsDevice.SetRenderTarget(Nothing) + _backgroundRenderer.Begin() Dim blurred = _blurHandler.Perform(target) _backgroundRenderer.Draw(blurred, New Rectangle(0, 0, windowSize.Width, windowSize.Height), Color.White) + + '_backgroundRenderer.Draw(target, New Rectangle(0, 0, windowSize.Width, windowSize.Height), Color.White) _backgroundRenderer.End() If IsCurrentScreen() Then @@ -135,7 +202,7 @@ Public Class PressStartScreen End If _shineRenderer.Begin(SpriteSortMode.Texture, BlendState.Additive) - _logoRenderer.Draw(_logoTexture, New Rectangle(CInt(ScreenSize.Width / 2) - 400, CInt(160 * _fadeIn), 768, 282), New Color(255, 255, 255, CInt(255 * _logoFade))) + _logoRenderer.Draw(_logoTexture, New Rectangle(CInt(ScreenSize.Width / 2) - 350, CInt(160 * _fadeIn), 700, 300), New Color(255, 255, 255, CInt(255 * _logoFade))) _shineRenderer.Draw(_shineTexture, New Rectangle(CInt(ScreenSize.Width / 2 - 250 + Math.Sin(tempF) * 240.0F), CInt(-100 + Math.Sin(tempG) * 10.0F + CInt(160 * _fadeIn)), 512, 512), New Color(255, 255, 255, CInt(255 * _logoFade))) If _fadeIn = 0F Then @@ -150,11 +217,11 @@ Public Class PressStartScreen Dim textSize As Vector2 = FontManager.GameJoltFont.MeasureString(text) GetFontRenderer().DrawString(FontManager.GameJoltFont, text, New Vector2(windowSize.Width / 2.0F - textSize.X / 2.0F, - windowSize.Height / 2.0F - textSize.Y / 2.0F + 100), Color.White) + windowSize.Height - textSize.Y - 50), _textColor) If ControllerHandler.IsConnected() Then SpriteBatch.Draw(TextureManager.GetTexture("GUI\GamePad\xboxControllerButtonA"), New Rectangle(CInt(windowSize.Width / 2 - textSize.X / 2 + FontManager.GameJoltFont.MeasureString("Press ").X), - CInt(windowSize.Height / 2 - textSize.Y / 2 + 98), 40, 40), Color.White) + CInt(windowSize.Height - textSize.Y - 50), 40, 40), Color.White) End If End If End If @@ -165,20 +232,6 @@ Public Class PressStartScreen Canvas.DrawRectangle(windowSize, New Color(0, 0, 0, CInt(255 * _fadeIn))) End Sub - Private Sub ChangeLevel() - Dim levelCount As Integer = 0 - For Each levelPath As String In System.IO.Directory.GetFiles(GameController.GamePath & "\Content\Data\maps\mainmenu\") - Dim levelFile As String = System.IO.Path.GetFileName(levelPath) - If levelFile.StartsWith("mainmenu") = True And levelFile.EndsWith(".dat") = True Then - levelCount += 1 - End If - Next - - Dim levelID As Integer = Core.Random.Next(0, levelCount) - - Level.Load("mainmenu\mainmenu" & levelID & ".dat") - End Sub - Public Overrides Sub ChangeTo() Core.Player.Unload() Core.Player.Skin = "Hilbert" diff --git a/P3D/Screens/MainMenu/Scene/Clouds.vb b/P3D/Screens/MainMenu/Scene/Clouds.vb new file mode 100644 index 000000000..c1f70f25f --- /dev/null +++ b/P3D/Screens/MainMenu/Scene/Clouds.vb @@ -0,0 +1,41 @@ +Imports GameDevCommon.Rendering +Imports GameDevCommon.Rendering.Composers +Imports GameDevCommon.Rendering.Texture + +Namespace Screens.MainMenu.Scene + + Public Class Clouds + + Inherits MainMenuEntity + + Public Sub New() + MyBase.New(New Vector3(0, -13, 0)) + End Sub + + Public Overrides Sub LoadContent() + Texture = TextureManager.LoadDirect("GUI\MainMenu\clouds.png") + + MyBase.LoadContent() + End Sub + + Public Overrides Sub Update() + Position.X += 0.2F + If Position.X >= 32.0F Then + Position.X = 0F + End If + + CreateWorld() + MyBase.Update() + End Sub + + Protected Overrides Sub CreateGeometry() + + Dim vertices = RectangleComposer.Create(320, 22, New TextureRectangle(0, 0, 10, 1)) + VertexTransformer.Rotate(vertices, New Vector3(MathHelper.PiOver2, 0, 0)) + Geometry.AddVertices(vertices) + + End Sub + + End Class + +End Namespace diff --git a/P3D/Screens/MainMenu/Scene/Ground.vb b/P3D/Screens/MainMenu/Scene/Ground.vb new file mode 100644 index 000000000..bf6589e06 --- /dev/null +++ b/P3D/Screens/MainMenu/Scene/Ground.vb @@ -0,0 +1,43 @@ +Imports GameDevCommon.Rendering +Imports GameDevCommon.Rendering.Composers +Imports GameDevCommon.Rendering.Texture + +Namespace Screens.MainMenu.Scene + + Public Class Ground + + Inherits MainMenuEntity + + Public Sub New() + MyBase.New(New Vector3(0, -13, 0)) + End Sub + + Public Overrides Sub LoadContent() + Texture = TextureManager.LoadDirect("GUI\MainMenu\ground.png") + + MyBase.LoadContent() + End Sub + + Public Overrides Sub Update() + Position.X += 0.2F + If Position.X >= 32.0F Then + Position.X = 0F + End If + + Position.Y = -50 + + CreateWorld() + MyBase.Update() + End Sub + + Protected Overrides Sub CreateGeometry() + + Dim vertices = RectangleComposer.Create(320, 96, New TextureRectangle(0, 0, 10, 1)) + VertexTransformer.Rotate(vertices, New Vector3(MathHelper.PiOver2, 0, 0)) + Geometry.AddVertices(vertices) + + End Sub + + End Class + +End Namespace diff --git a/P3D/Screens/MainMenu/Scene/HoOh.vb b/P3D/Screens/MainMenu/Scene/HoOh.vb new file mode 100644 index 000000000..c67e40772 --- /dev/null +++ b/P3D/Screens/MainMenu/Scene/HoOh.vb @@ -0,0 +1,97 @@ +Imports GameDevCommon.Rendering +Imports GameDevCommon.Rendering.Composers +Imports GameDevCommon.Rendering.Texture + +Namespace Screens.MainMenu.Scene + + Public Class HoOh + + Inherits MainMenuEntity + + Private Shared _random As Random = New Random() + + Private _entities As List(Of MainMenuEntity) + Private _textures As Texture2D() + Private _textureIndex As Integer = 0 + Private _animationDelay As Integer = 10 + + Public Sub New(entities As List(Of MainMenuEntity)) + MyBase.New(New Vector3(0, -13, 1)) + Rotation.Y = -0.2F + _entities = entities + End Sub + + Public Overrides Sub LoadContent() + Dim t = TextureManager.LoadDirect("GUI\MainMenu\hooh.png") + Dim colors = New Color(80 * 48 - 1) {} + Dim textures = New List(Of Texture2D) + + For x = 0 To 4 + + t.GetData(0, New Rectangle(x * 80, 0, 80, 48), colors, 0, colors.Length) + Dim tex = New Texture2D(GraphicsDevice, 80, 48) + tex.SetData(colors) + textures.Add(tex) + + Next + + _textures = textures.ToArray() + + Texture = _textures(_textureIndex) + + MyBase.LoadContent() + End Sub + + Public Overrides Sub Update() + _animationDelay -= 1 + If _animationDelay = 0 Then + _animationDelay = 8 + _textureIndex += 1 + If _textureIndex = _textures.Length Then + _textureIndex = 0 + End If + + Texture = _textures(_textureIndex) + + For i = 0 To _random.Next(1, 4) + + Dim particle = New HoOhParticle(Position + + New Vector3(6, GetParticleY() * 10, 0) + + New Vector3(_random.Next(-3, 4), _random.Next(-3, 4), 0), _random.Next(0, 4)) + particle.LoadContent() + _entities.Add(particle) + + Next + End If + + CreateWorld() + MyBase.Update() + End Sub + + Protected Overrides Sub CreateGeometry() + + Dim vertices = RectangleComposer.Create(37, 22) + VertexTransformer.Rotate(vertices, New Vector3(MathHelper.PiOver2, 0, 0)) + Geometry.AddVertices(vertices) + + End Sub + + Private Function GetParticleY() As Integer + Select Case _textureIndex + Case 0 + Return 1 + Case 1 + Return 0 + Case 2 + Return -1 + Case 3 + Return 1 + Case 4 + Return 1 + End Select + Return 0 + End Function + + End Class + +End Namespace diff --git a/P3D/Screens/MainMenu/Scene/HoOhParticle.vb b/P3D/Screens/MainMenu/Scene/HoOhParticle.vb new file mode 100644 index 000000000..001e675ea --- /dev/null +++ b/P3D/Screens/MainMenu/Scene/HoOhParticle.vb @@ -0,0 +1,61 @@ +Imports GameDevCommon.Rendering +Imports GameDevCommon.Rendering.Composers +Imports GameDevCommon.Rendering.Texture + +Namespace Screens.MainMenu.Scene + + Public Class HoOhParticle + + Inherits MainMenuEntity + + Private Shared _particleTexture As Texture2D + Private Shared _particleTextures As Dictionary(Of Integer, Texture2D) = New Dictionary(Of Integer, Texture2D)() + + Private ReadOnly _texVariant As Integer + + Public Sub New(position As Vector3, texVariant As Integer) + MyBase.New(position) + _texVariant = texVariant + IsOpaque = False + End Sub + + Public Overrides Sub LoadContent() + If _particleTexture Is Nothing Then + _particleTexture = TextureManager.LoadDirect("GUI\MainMenu\hoohParticles.png") + For i = 0 To 3 + Dim colors = New Color(5 * 5 - 1) {} + _particleTexture.GetData(0, New Rectangle(i * 5, 0, 5, 5), colors, 0, colors.Length) + Dim tex = New Texture2D(GraphicsDevice, 5, 5) + tex.SetData(colors) + _particleTextures.Add(i, tex) + Next + End If + + Texture = _particleTextures(_texVariant) + + MyBase.LoadContent() + End Sub + + Public Overrides Sub Update() + Position.X += 1 + Alpha -= 0.02F + + If Alpha <= 0F Then + ToBeRemoved = True + End If + + CreateWorld() + MyBase.Update() + End Sub + + Protected Overrides Sub CreateGeometry() + + Dim vertices = RectangleComposer.Create(4, 4) + VertexTransformer.Rotate(vertices, New Vector3(MathHelper.PiOver2, 0, 0)) + Geometry.AddVertices(vertices) + + End Sub + + End Class + +End Namespace diff --git a/P3D/Screens/MainMenu/Scene/Lugia.vb b/P3D/Screens/MainMenu/Scene/Lugia.vb new file mode 100644 index 000000000..a0843df0a --- /dev/null +++ b/P3D/Screens/MainMenu/Scene/Lugia.vb @@ -0,0 +1,79 @@ +Imports GameDevCommon.Rendering +Imports GameDevCommon.Rendering.Composers +Imports GameDevCommon.Rendering.Texture + +Namespace Screens.MainMenu.Scene + + Public Class Lugia + + Inherits MainMenuEntity + + Private Shared _random As Random = New Random() + + Private _entities As List(Of MainMenuEntity) + Private _textures As Texture2D() + Private _textureIndex As Integer = 0 + Private _animationDelay As Integer = 10 + + Public Sub New(entities As List(Of MainMenuEntity)) + MyBase.New(New Vector3(0, -13, 1)) + Rotation.Y = -0.2F + _entities = entities + End Sub + + Public Overrides Sub LoadContent() + Dim t = TextureManager.LoadDirect("GUI\MainMenu\lugia.png") + Dim colors = New Color(80 * 48 - 1) {} + Dim textures = New List(Of Texture2D) + + For x = 0 To 3 + + t.GetData(0, New Rectangle(x * 80, 0, 80, 48), colors, 0, colors.Length) + Dim tex = New Texture2D(GraphicsDevice, 80, 48) + tex.SetData(colors) + textures.Add(tex) + + Next + + _textures = textures.ToArray() + + Texture = _textures(_textureIndex) + + MyBase.LoadContent() + End Sub + + Public Overrides Sub Update() + _animationDelay -= 1 + If _animationDelay = 0 Then + _animationDelay = 12 + _textureIndex += 1 + If _textureIndex = _textures.Length Then + _textureIndex = 0 + End If + + Texture = _textures(_textureIndex) + + For i = 0 To _random.Next(1, 4) + + Dim particle = New LugiaParticle(Position + New Vector3(10, -5, 0)) + particle.LoadContent() + _entities.Add(particle) + + Next + End If + + CreateWorld() + MyBase.Update() + End Sub + + Protected Overrides Sub CreateGeometry() + + Dim vertices = RectangleComposer.Create(37, 22) + VertexTransformer.Rotate(vertices, New Vector3(MathHelper.PiOver2, 0, 0)) + Geometry.AddVertices(vertices) + + End Sub + + End Class + +End Namespace diff --git a/P3D/Screens/MainMenu/Scene/LugiaParticle.vb b/P3D/Screens/MainMenu/Scene/LugiaParticle.vb new file mode 100644 index 000000000..fb24f1655 --- /dev/null +++ b/P3D/Screens/MainMenu/Scene/LugiaParticle.vb @@ -0,0 +1,54 @@ +Imports GameDevCommon.Rendering +Imports GameDevCommon.Rendering.Composers +Imports GameDevCommon.Rendering.Texture + +Namespace Screens.MainMenu.Scene + + Public Class LugiaParticle + + Inherits MainMenuEntity + + Private Shared _particleTexture As Texture2D + Dim _phase As Single + + Public Sub New(position As Vector3) + MyBase.New(position) + IsOpaque = False + End Sub + + Public Overrides Sub LoadContent() + If _particleTexture Is Nothing Then + _particleTexture = TextureManager.LoadDirect("GUI\MainMenu\lugiaParticle.png") + End If + + Texture = _particleTexture + + MyBase.LoadContent() + End Sub + + Public Overrides Sub Update() + _phase += 0.4F + + Position.X += 1.2F + Position.Y += CType(Math.Sin(_phase), Single) + Alpha -= 0.01F + + If Alpha <= 0F Then + ToBeRemoved = True + End If + + CreateWorld() + MyBase.Update() + End Sub + + Protected Overrides Sub CreateGeometry() + + Dim vertices = RectangleComposer.Create(8, 8) + VertexTransformer.Rotate(vertices, New Vector3(MathHelper.PiOver2, 0, 0)) + Geometry.AddVertices(vertices) + + End Sub + + End Class + +End Namespace diff --git a/P3D/Screens/MainMenu/Scene/MainMenuCamera.vb b/P3D/Screens/MainMenu/Scene/MainMenuCamera.vb new file mode 100644 index 000000000..037ac84ca --- /dev/null +++ b/P3D/Screens/MainMenu/Scene/MainMenuCamera.vb @@ -0,0 +1,24 @@ +Namespace Screens.MainMenu.Scene + + Public Class MainMenuCamera + + Inherits GameDevCommon.Rendering.PerspectiveCamera + + Public Sub New() + Pitch = 0 + FOV = 45 + Position = New Vector3(0, 0, 100) + + CreateView() + CreateProjection() + End Sub + + Public Overrides Sub Update() + Yaw = -0.1F + + CreateView() + End Sub + + End Class + +End Namespace diff --git a/lib/build/GameDevCommon.dll b/lib/build/GameDevCommon.dll new file mode 100644 index 000000000..06b5257b8 Binary files /dev/null and b/lib/build/GameDevCommon.dll differ diff --git a/lib/build/Pokemon3D.exe b/lib/build/Pokemon3D.exe index 30f7a67a6..41aec6d1f 100644 Binary files a/lib/build/Pokemon3D.exe and b/lib/build/Pokemon3D.exe differ