⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 engine.vb.svn-base

📁 MirUnleashed vb.net Module modMainServer Public WithEvents Socket As New WinsockServer Pub
💻 SVN-BASE
📖 第 1 页 / 共 2 页
字号:
        BaseX = Actor.CurrentX
        BaseY = Actor.CurrentY

        If MistyLoaded(0) = False Then
            MistyTexture(0) = TextureLoader.FromFile(D3D, My.Application.Info.DirectoryPath & "\Data\fog.bmp", 800, 600, 0, 0, Format.A8B8G8R8, Pool.Managed, Filter.None, Filter.None, 1)
            MistyLoaded(0) = True
        End If

        If MistyLoaded(1) = False Then
            MistyTexture(1) = TextureLoader.FromFile(D3D, My.Application.Info.DirectoryPath & "\Data\fogsmall.bmp", 800, 600, 0, 0, Format.A8B8G8R8, Pool.Managed, Filter.None, Filter.None, 1)
            MistyLoaded(1) = True
        End If

        GameSprite.End()
        GameSprite.Begin(SpriteFlags.AlphaBlend)
        SetBlend(0.4)
        GameSprite.Draw(MistyTexture(0), Rectangle.Empty, New Microsoft.DirectX.Vector3(0, 0, 0), New Microsoft.DirectX.Vector3(0, 0, 0), Color.White)
        GameSprite.End()

        GameSprite.Begin(SpriteFlags.AlphaBlend)
        D3D.RenderState.AlphaBlendEnable = True
        D3D.RenderState.SourceBlend = Blend.SourceColor
        D3D.RenderState.DestinationBlend = Blend.One

        Game.SmallFogTimer1.Enabled = True
        GameSprite.Draw(MistyTexture(1), Rectangle.Empty, New Microsoft.DirectX.Vector3(0, 0, 0), New Microsoft.DirectX.Vector3(MistX, MistY, 0), Color.Gray)
        GameSprite.Draw(MistyTexture(1), Rectangle.Empty, New Microsoft.DirectX.Vector3(0, 0, 0), New Microsoft.DirectX.Vector3(MistX + 160, MistY, 0), Color.Gray)
        GameSprite.Draw(MistyTexture(1), Rectangle.Empty, New Microsoft.DirectX.Vector3(0, 0, 0), New Microsoft.DirectX.Vector3(MistX + 360, MistY + 55, 0), Color.Gray)

        Game.SmallFogTimer2.Enabled = True
        GameSprite.Draw(MistyTexture(1), Rectangle.Empty, New Microsoft.DirectX.Vector3(0, 0, 0), New Microsoft.DirectX.Vector3(MistX2 + 150, MistY2, 0), Color.Gray)
        GameSprite.Draw(MistyTexture(1), Rectangle.Empty, New Microsoft.DirectX.Vector3(0, 0, 0), New Microsoft.DirectX.Vector3(MistX2 + 350, MistY2, 0), Color.Gray)
        GameSprite.Draw(MistyTexture(1), Rectangle.Empty, New Microsoft.DirectX.Vector3(0, 0, 0), New Microsoft.DirectX.Vector3(MistX2 + 450, MistY2, 0), Color.Gray)

        GameSprite.End()

        GameSprite.Begin(SpriteFlags.AlphaBlend)

    End Sub

    Public Sub DrawGlow()

        Dim TempX As Integer
        Dim TempY As Integer
        Dim I As Integer

        Dim BaseX As Single
        Dim BaseY As Single

        BaseX = Actor.CurrentX
        BaseY = Actor.CurrentY

        If GlowLoaded(0) = False Then
            GlowTexture(0) = TextureLoader.FromFile(D3D, My.Application.Info.DirectoryPath & "\Data\Glow.bmp", 800, 600, 0, 0, Format.A8B8G8R8, Pool.Managed, Filter.None, Filter.None, 1)
            GlowLoaded(0) = True
        End If

        TempY = (GameHeight / 2) - 324
        TempX = (GameWidth / 2) - 400

        D3D.RenderState.AlphaBlendEnable = True

        D3D.RenderState.SourceBlend = Blend.One
        D3D.RenderState.DestinationBlend = Blend.One

        GameSprite.Draw(GlowTexture(0), Rectangle.Empty, New Microsoft.DirectX.Vector3(0, 0, 0), New Microsoft.DirectX.Vector3(TempX, TempY, 0), Color.White)

    End Sub

    Public Sub DrawSnow()

        Dim TempX As Integer
        Dim TempY As Integer
        Dim I As Integer

        Dim BaseX As Single
        Dim BaseY As Single

        BaseX = Actor.CurrentX
        BaseY = Actor.CurrentY

        If SnowyLoaded(0) = False Then
            SnowyTexture(0) = TextureLoader.FromFile(D3D, My.Application.Info.DirectoryPath & "\Data\Snow.bmp", 800, 600, 0, 0, Format.A8B8G8R8, Pool.Managed, Filter.None, Filter.None, 1)
            SnowyLoaded(0) = True
        End If

        D3D.RenderState.AlphaBlendEnable = True

        D3D.RenderState.SourceBlend = Blend.One
        D3D.RenderState.DestinationBlend = Blend.One

        Game.SnowTimer.Enabled = True
        Game.SnowTimer1.Enabled = True

        GameSprite.Draw(SnowyTexture(0), Rectangle.Empty, New Microsoft.DirectX.Vector3(0, 0, 0), New Microsoft.DirectX.Vector3(SnowX + 100, SnowY, 0), Color.White)

    End Sub

    Public Sub DrawFog()

        Dim TempX As Integer
        Dim TempY As Integer
        Dim I As Integer

        Dim BaseX As Single
        Dim BaseY As Single

        BaseX = Actor.CurrentX
        BaseY = Actor.CurrentY

        If FogLoaded(0) = False Then
            FogTexture(0) = TextureLoader.FromFile(D3D, My.Application.Info.DirectoryPath & "\Data\0.bmp", 800, 600, 0, 0, Format.A8B8G8R8, Pool.Managed, Filter.None, Filter.None, 1)
            FogLoaded(0) = True
        End If

        If FogLoaded(1) = False Then
            FogTexture(1) = TextureLoader.FromFile(D3D, My.Application.Info.DirectoryPath & "\Data\2.bmp", 1600, 1200, 0, 0, Format.A8B8G8R8, Pool.Managed, Filter.None, Filter.None, 1)
            FogLoaded(1) = True
        End If

        If FogLoaded(2) = False Then
            FogTexture(2) = TextureLoader.FromFile(D3D, My.Application.Info.DirectoryPath & "\Data\3.bmp", 800, 600, 0, 0, Format.A8B8G8R8, Pool.Managed, Filter.None, Filter.None, 1)
            FogLoaded(2) = True
        End If

        'check through lights
        Dim TempInt As Integer

        For I = 0 To 10000
            If LightExist(I) = True Then
                If LightType(I) = 1 Then ' map light

                    TempY = (GameHeight / 2) + (32 * (LightMapCordY(I) - (BaseY))) - 68 + 10 - (492 / 2) - 40 - (492 / 3)
                    TempX = (GameWidth / 2) + (48 * (LightMapCordX(I) - (BaseX))) - 26 - (473 / 2) - 10 - (473 / 3)

                    D3D.RenderState.AlphaBlendEnable = True

                    D3D.RenderState.SourceBlend = Blend.One
                    D3D.RenderState.DestinationBlend = Blend.One

                    GameSprite.Draw(FogTexture(1), Rectangle.Empty, New Microsoft.DirectX.Vector3(0, 0, 0), New Microsoft.DirectX.Vector3(TempX, TempY, 0), FogColour)


                ElseIf LightType(I) = 2 Then ' actor light

                    TempY = (GameHeight / 2) - 68 + 10 - (492 / 2) - 2
                    TempX = (GameWidth / 2) - 26 - (473 / 2) + 10

                    D3D.RenderState.AlphaBlendEnable = True

                    D3D.RenderState.SourceBlend = Blend.One
                    D3D.RenderState.DestinationBlend = Blend.One

                    GameSprite.Draw(FogTexture(0), Rectangle.Empty, New Microsoft.DirectX.Vector3(0, 0, 0), New Microsoft.DirectX.Vector3(TempX, TempY, 0), FogColour)

                ElseIf LightType(I) = 3 Then ' player light

                    TempY = (GameHeight / 2) + (32 * (Player(PlayerGameIndex(LightIndex(I))).CurrentY - (BaseY))) - 68 + 10 - (492 / 2) - 2
                    TempX = (GameWidth / 2) + (48 * (Player(PlayerGameIndex(LightIndex(I))).CurrentX - (BaseX))) - 26 - (473 / 2) + 10


                    D3D.RenderState.AlphaBlendEnable = True

                    D3D.RenderState.SourceBlend = Blend.One
                    D3D.RenderState.DestinationBlend = Blend.One

                    GameSprite.Draw(FogTexture(0), Rectangle.Empty, New Microsoft.DirectX.Vector3(0, 0, 0), New Microsoft.DirectX.Vector3(TempX, TempY, 0), FogColour)

                ElseIf LightType(I) = 4 Then ' NPC light


                    TempY = (GameHeight / 2) + (32 * (NPC(NPCGameIndex(LightIndex(I))).Y - (BaseY))) - 68 + 10 - (492 / 2) - 2
                    TempX = (GameWidth / 2) + (48 * (NPC(NPCGameIndex(LightIndex(I))).X - (BaseX))) - 26 - (473 / 2) + 10


                    D3D.RenderState.AlphaBlendEnable = True

                    D3D.RenderState.SourceBlend = Blend.One
                    D3D.RenderState.DestinationBlend = Blend.One

                    GameSprite.Draw(FogTexture(0), Rectangle.Empty, New Microsoft.DirectX.Vector3(0, 0, 0), New Microsoft.DirectX.Vector3(TempX, TempY, 0), FogColour)

                ElseIf LightType(I) = 6 Then ' Magic light


                    D3D.RenderState.AlphaBlendEnable = True

                    D3D.RenderState.SourceBlend = Blend.One
                    D3D.RenderState.DestinationBlend = Blend.One


                    If Magic(LightIndex(I)).Light = 1 Then 'small light

                        TempY = (GameHeight / 2) + (32 * (Magic(LightIndex(I)).CordY - (BaseY))) - 68 + 10 - (492 / 2) - 2
                        TempX = (GameWidth / 2) + (48 * (Magic(LightIndex(I)).CordX - (BaseX))) - 26 - (473 / 2) + 10

                        GameSprite.Draw(FogTexture(0), Rectangle.Empty, New Microsoft.DirectX.Vector3(0, 0, 0), New Microsoft.DirectX.Vector3(TempX, TempY, 0), FogColour)
                        GameSprite.Draw(FogTexture(0), Rectangle.Empty, New Microsoft.DirectX.Vector3(0, 0, 0), New Microsoft.DirectX.Vector3(TempX, TempY, 0), MagicFogColour)

                    ElseIf Magic(LightIndex(I)).Light = 2 Then 'big light

                        TempY = (GameHeight / 2) + (32 * (Magic(LightIndex(I)).CordY - (BaseY))) - 68 + 10 - (492 / 2) - (492 / 3) + 20
                        TempX = (GameWidth / 2) + (48 * (Magic(LightIndex(I)).CordX - (BaseX))) - 26 - (473 / 2) - (473 / 3) + 30

                        GameSprite.Draw(FogTexture(1), Rectangle.Empty, New Microsoft.DirectX.Vector3(0, 0, 0), New Microsoft.DirectX.Vector3(TempX, TempY, 0), FogColour)
                        GameSprite.Draw(FogTexture(1), Rectangle.Empty, New Microsoft.DirectX.Vector3(0, 0, 0), New Microsoft.DirectX.Vector3(TempX, TempY, 0), MagicFogColour)

                    End If

                End If

                TempInt = TempInt + 1
            End If

            If LightTotal = TempInt Then Exit For

        Next I

    End Sub

    Public Sub DrawFogScene()

        Dim TempX As Integer
        Dim TempY As Integer
        Dim TempInt As Integer

        GameSprite.Begin(SpriteFlags.AlphaBlend)

        D3D.RenderState.AlphaBlendEnable = True

        D3D.RenderState.SourceBlend = Blend.Zero
        D3D.RenderState.DestinationBlend = Blend.SourceColor

        TempX = 0
        TempY = 0

        GameSprite.Draw(AlphaTexture, Rectangle.Empty, New Microsoft.DirectX.Vector3(0, 0, 0), New Microsoft.DirectX.Vector3(TempX, TempY, 0), Color.White)

        GameSprite.End()

    End Sub

    Public Sub DrawGameSurface()
        Dim TempX, TempY As Integer

        TempX = 0
        TempY = 0

        GameSprite.Begin(SpriteFlags.DoNotSaveState)

        GameSprite.Transform = Matrix.RotationZ(0) * Matrix.Scaling(1.0, 1.0, 1.0F) * Matrix.Translation(TempX, TempY, 0.0F)
        GameSprite.Draw(GameTexture, Rectangle.Empty, New Microsoft.DirectX.Vector3(0, 0, 0), New Microsoft.DirectX.Vector3(TempX, TempY, 0), Color.White)
        GameSprite.Transform = Matrix.RotationZ(0) * Matrix.Scaling(1, 1, 1.0F) * Matrix.Translation(TempX, TempY, 0.0F)

        GameSprite.End()

    End Sub

    Public Sub Terminate()
        Cursor.Show()
        D3Dpp = Nothing
        D3D.Dispose()
        D3D = Nothing
        Application.Exit()
        System.Environment.Exit(System.Environment.ExitCode)
    End Sub

    Public Sub LoadFonts()
        TempText.Size6.SystemBold = New System.Drawing.Font("standard 07_55", 6, FontStyle.Bold)
        TempText.Size6.SystemNormal = New System.Drawing.Font("standard 07_55", 6, FontStyle.Regular)
        TempText.Size6.D3DBold = New Direct3D.Font(D3D, TempText.Size6.SystemBold)
        TempText.Size6.D3DNormal = New Direct3D.Font(D3D, TempText.Size6.SystemNormal)

        TempText.Size8.SystemBold = New System.Drawing.Font("Verdana", 8, FontStyle.Bold)
        TempText.Size8.SystemNormal = New System.Drawing.Font("Verdana", 8, FontStyle.Regular)
        TempText.Size8.D3DBold = New Direct3D.Font(D3D, TempText.Size8.SystemBold)
        TempText.Size8.D3DNormal = New Direct3D.Font(D3D, TempText.Size8.SystemNormal)

        TempText.Size9.SystemBold = New System.Drawing.Font("Verdana", 9, FontStyle.Bold)
        TempText.Size9.SystemNormal = New System.Drawing.Font("Verdana", 9, FontStyle.Regular)
        TempText.Size9.D3DBold = New Direct3D.Font(D3D, TempText.Size9.SystemBold)
        TempText.Size9.D3DNormal = New Direct3D.Font(D3D, TempText.Size9.SystemNormal)

        TempText.Size10.SystemBold = New System.Drawing.Font("Calibri", 10, FontStyle.Bold)
        TempText.Size10.SystemNormal = New System.Drawing.Font("Calibri", 10, FontStyle.Regular)
        TempText.Size10.D3DBold = New Direct3D.Font(D3D, TempText.Size10.SystemBold)
        TempText.Size10.D3DNormal = New Direct3D.Font(D3D, TempText.Size10.SystemNormal)
    End Sub

End Module

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -