Example #1
0
        public void DirectXThread()
        {
            if (Settings.DemoMode)
            {
                PrepareTestModeObjects();
            }
            else
            {
                PrepareObjects();
            }

            try
            {
                device.BeginDraw();
                device.Clear(SharpDX.Color.Transparent);
                device.TextAntialiasMode = SharpDX.Direct2D1.TextAntialiasMode.Aliased;
                StringBuilder strBuild = new StringBuilder();
                PrepareCrossHair();
                RenderItem renderItem;

                // Window Border
                renderItem = new RenderItem();
                renderItem.structs.Text       = "rectangle";
                renderItem.structs.Size       = 1;
                renderItem.structs.DrawColor  = Color.Fuchsia;
                renderItem.structs.MapPosX    = -Width / 2f;
                renderItem.structs.MapPosZ    = -Height / 2f;
                renderItem.structs.MapPosXend = (Width / 2) - 1;
                renderItem.structs.MapPosZend = (Height / 2) - 1;
                HelperOpenGL.OverlayGeometry.Add(renderItem);

                renderItem = new RenderItem();
                renderItem.structs.Text       = "rectangle";
                renderItem.structs.Size       = 1;
                renderItem.structs.DrawColor  = Color.Fuchsia;
                renderItem.structs.MapPosX    = (-Width / 2) + 1;
                renderItem.structs.MapPosZ    = (-Height / 2) + 1;
                renderItem.structs.MapPosXend = (Width / 2) - 2;
                renderItem.structs.MapPosZend = (Height / 2) - 2;
                HelperOpenGL.OverlayGeometry.Add(renderItem);

                GlControl_Overlay_RenderObjects();

                device.Flush();
                device.EndDraw();
                renderOverlayComplete = true;
            }
            catch
            {
                try
                {
                    device.Flush();
                    device.EndDraw();
                }
                catch
                {
                }
            }
        }
Example #2
0
        private void PrepareTestModeObjects()
        {
            var degressFOV = DateTime.Now.Second * 6;
            var fov_line_X = (float)(Math.Cos(((degressFOV * Math.PI) / -180) + (Math.PI / 2)) * 100);
            var fov_line_Y = (float)(Math.Sin(((degressFOV * Math.PI) / -180) - (Math.PI / 2)) * 100);

            RenderItem renderItem;

            renderItem = new RenderItem();
            renderItem.structs.Text       = "line";
            renderItem.structs.Size       = 2;
            renderItem.structs.DrawColor  = Color.LimeGreen;
            renderItem.structs.MapPosX    = 0;
            renderItem.structs.MapPosZ    = 0;
            renderItem.structs.MapPosXend = fov_line_X;
            renderItem.structs.MapPosZend = fov_line_Y;
            HelperOpenGL.OverlayGeometry.Add(renderItem);

            renderItem = new RenderItem();
            renderItem.structs.Text      = "circle";
            renderItem.structs.Size      = 2;
            renderItem.structs.DrawColor = Color.LimeGreen;
            renderItem.structs.MapPosX   = 0;
            renderItem.structs.MapPosZ   = 0;
            renderItem.structs.Size      = 80;
            HelperOpenGL.OverlayGeometry.Add(renderItem);

            renderItem = new RenderItem();
            renderItem.structs.Text        = DateTime.Now.ToString();
            renderItem.structs.Size        = 2;
            renderItem.structs.DrawColor   = Color.LimeGreen;
            renderItem.structs.MapPosX     = 0;
            renderItem.structs.MapPosZ     = 100;
            renderItem.structs.Size        = (int)FontSizes.misc;
            renderItem.structs.TextOutline = true;
            HelperOpenGL.OverlayText.Add(renderItem);
        }
Example #3
0
        private void PrepareObjects()
        {
            if (HelperOpenGL.PlayerListToRenderFinal.Count == 0)
            {
                return;
            }

            var myPosX = HelperOpenGL.PlayerListToRenderFinal[0].MapLocX;
            var myPosY = HelperOpenGL.PlayerListToRenderFinal[0].MapLocY;
            var myPosZ = HelperOpenGL.PlayerListToRenderFinal[0].MapLocZ;

            Numerics.Matrix4x4?matrix = null;

            // Draw player ESP.
            var vectorMe = new OpenTK.Vector3(myPosX, myPosY, myPosZ);

            RenderItem renderItem;

            try
            {
                for (int i = 0; i < HelperOpenGL.PlayerListToRenderFinal.Count; i++)
                {
                    // Don`t draw who at 0.0.0
                    if (HelperOpenGL.PlayerListToRenderFinal[i].MapLocX == 0 || HelperOpenGL.PlayerListToRenderFinal[i].MapLocZ == 0)
                    {
                        continue;
                    }

                    // Because 0 is always our player and we don`t need esp for ourselves.
                    if (i != 0)
                    {
                        var entityPosXoriginal = HelperOpenGL.PlayerListToRenderFinal[i].MapLocX;
                        var entityPosYoriginal = HelperOpenGL.PlayerListToRenderFinal[i].MapLocY;
                        var entityPosZoriginal = HelperOpenGL.PlayerListToRenderFinal[i].MapLocZ;

                        switch (HelperOpenGL.PlayerListToRenderFinal[i].Pose)
                        {
                        case "Standing":
                            heightToHead = heightForStand;
                            break;

                        case "Crouch":
                            heightToHead = heightForCrouch;
                            break;

                        case "Prone":
                            heightToHead = heightForProne;
                            break;

                        default:
                            heightToHead = heightForStand;
                            break;
                        }

                        var vectorTarget     = new OpenTK.Vector3(entityPosXoriginal, entityPosYoriginal + playerFeetVector, entityPosZoriginal);
                        var vectorTargetHead = new OpenTK.Vector3(vectorTarget.X, vectorTarget.Y + heightToHead, vectorTarget.Z);

                        float distance = (int)Math.Round(Helper.GetDistance(vectorMe, vectorTarget));

                        if (distance < 500 && distance > 2)
                        {
                            if (matrix == null)
                            {
                                matrix = Memory.Read <System.Numerics.Matrix4x4>(CameraMatrixPointer.ToInt64());
                            }

                            var wts     = WorldToScreen(vectorTarget, out OpenTK.Vector3 coords, matrix, Width, Height);
                            var wtsHead = WorldToScreen(vectorTargetHead, out OpenTK.Vector3 coordsHead, matrix, Width, Height);

                            if (wts)
                            {
                                /* X.Y.
                                 * Left Top ( - | - )
                                 * Right Bottom ( + | + )
                                 */

                                var rectX1  = coordsHead.X - ((coordsHead.Y - coords.Y) / 3);
                                var rectY1  = coordsHead.Y;
                                var rectX2  = coords.X + ((coordsHead.Y - coords.Y) / 3);
                                var rectY2  = coords.Y;
                                var offsetY = 0;

                                renderItem = new RenderItem();
                                renderItem.structs.Text       = "rectangle";
                                renderItem.structs.Size       = 1;
                                renderItem.structs.DrawColor  = Color.Black;
                                renderItem.structs.MapPosX    = rectX1 + 8;
                                renderItem.structs.MapPosZ    = rectY1 - 8;
                                renderItem.structs.MapPosXend = rectX2 - 8;
                                renderItem.structs.MapPosZend = rectY2 + 8;
                                HelperOpenGL.OverlayGeometry.Add(renderItem);

                                // Main Rect.
                                renderItem = new RenderItem();
                                renderItem.structs.Text       = "rectangle";
                                renderItem.structs.Size       = 1;
                                renderItem.structs.DrawColor  = HelperOpenGL.PlayerListToRenderFinal[i].Drawcolor;
                                renderItem.structs.MapPosX    = rectX1 + 7;
                                renderItem.structs.MapPosZ    = rectY1 - 7;
                                renderItem.structs.MapPosXend = rectX2 - 7;
                                renderItem.structs.MapPosZend = rectY2 + 7;
                                HelperOpenGL.OverlayGeometry.Add(renderItem);

                                // Head.
                                renderItem = new RenderItem();
                                renderItem.structs.Text       = "rectangle";
                                renderItem.structs.Size       = 1;
                                renderItem.structs.DrawColor  = HelperOpenGL.PlayerListToRenderFinal[i].Drawcolor;
                                renderItem.structs.MapPosX    = coordsHead.X;
                                renderItem.structs.MapPosZ    = coordsHead.Y;
                                renderItem.structs.MapPosXend = coordsHead.X;
                                renderItem.structs.MapPosZend = coordsHead.Y;
                                HelperOpenGL.OverlayGeometry.Add(renderItem);

                                HelperOpenGL.OverlayGeometry.Add(renderItem);
                                renderItem = new RenderItem();
                                renderItem.structs.Text       = "rectangle";
                                renderItem.structs.Size       = 1;
                                renderItem.structs.DrawColor  = Color.Black;
                                renderItem.structs.MapPosX    = coordsHead.X + 1;
                                renderItem.structs.MapPosZ    = coordsHead.Y - 1;
                                renderItem.structs.MapPosXend = coordsHead.X - 1;
                                renderItem.structs.MapPosZend = coordsHead.Y + 1;
                                HelperOpenGL.OverlayGeometry.Add(renderItem);

                                // Text.

                                // Nickname (DISABLED)
                                if (Settings.MapShowPlayerName && false)
                                {
                                    renderItem = new RenderItem();
                                    renderItem.structs.Text        = HelperOpenGL.PlayerListToRenderFinal[i].Nickname;
                                    renderItem.structs.TextOutline = true;
                                    renderItem.structs.MapPosX     = coords.X;
                                    renderItem.structs.MapPosZ     = coords.Y + 10 + offsetY;
                                    renderItem.structs.Size        = (int)FontSizes.misc;
                                    renderItem.structs.DrawColor   = HelperOpenGL.PlayerListToRenderFinal[i].Drawcolor;
                                    HelperOpenGL.OverlayText.Add(renderItem);
                                    offsetY += 10;
                                }

                                // Distance
                                if (Settings.MapShowPlayerDistance)
                                {
                                    renderItem = new RenderItem();
                                    renderItem.structs.Text        = (int)distance + "m";
                                    renderItem.structs.TextOutline = true;
                                    renderItem.structs.MapPosX     = coords.X;
                                    renderItem.structs.MapPosZ     = coords.Y + 15 + offsetY;
                                    renderItem.structs.Size        = (int)FontSizes.misc;
                                    renderItem.structs.DrawColor   = Settings.ColorText;
                                    HelperOpenGL.OverlayText.Add(renderItem);
                                    offsetY += 15;
                                }

                                // Weapon (DISABLED)
                                if (Settings.MapShowPlayerWeapons && false)
                                {
                                    // Weapon
                                    renderItem = new RenderItem();
                                    renderItem.structs.Text        = HelperOpenGL.PlayerListToRenderFinal[i].Weapon;
                                    renderItem.structs.TextOutline = true;
                                    renderItem.structs.MapPosX     = coords.X;
                                    renderItem.structs.MapPosZ     = coords.Y + 15 + offsetY;
                                    renderItem.structs.Size        = (int)FontSizes.misc;
                                    renderItem.structs.DrawColor   = Settings.ColorText;
                                    HelperOpenGL.OverlayText.Add(renderItem);
                                    offsetY += 15;
                                }

                                if (Settings.MapShowPlayerName)
                                {
                                    // Pose
                                    renderItem = new RenderItem();
                                    renderItem.structs.Text        = HelperOpenGL.PlayerListToRenderFinal[i].Pose;
                                    renderItem.structs.TextOutline = true;
                                    renderItem.structs.MapPosX     = coords.X;
                                    renderItem.structs.MapPosZ     = coords.Y + 10 + offsetY;
                                    renderItem.structs.Size        = (int)FontSizes.misc;
                                    renderItem.structs.DrawColor   = HelperOpenGL.PlayerListToRenderFinal[i].Drawcolor;
                                    HelperOpenGL.OverlayText.Add(renderItem);
                                }
                            }
                        }
                    }
                }

                if (Settings.FindLoot)
                {
                    // Draw loot ESP.
                    for (int i = 0; i < HelperOpenGL.LootListToRenderFinal.Count; i++)
                    {
                        // Don`t draw who at 0.0.0
                        if (HelperOpenGL.LootListToRenderFinal[i].MapLocX == 0 || HelperOpenGL.LootListToRenderFinal[i].MapLocZ == 0)
                        {
                            continue;
                        }

                        var indexOfL = Settings.LootListToLookFor.IndexOf(HelperOpenGL.LootListToRenderFinal[i].Lootname);
                        if (indexOfL < 0)
                        {
                            // We dont.
                        }

                        if (indexOfL >= 0)
                        {
                            // We do.
                            var lootPosXoriginal = HelperOpenGL.LootListToRenderFinal[i].MapLocX;
                            var lootPosYoriginal = HelperOpenGL.LootListToRenderFinal[i].MapLocY;
                            var lootPosZoriginal = HelperOpenGL.LootListToRenderFinal[i].MapLocZ;

                            var vectorTarget = new OpenTK.Vector3(lootPosXoriginal, lootPosYoriginal, lootPosZoriginal);

                            float distance = (int)Math.Round(Helper.GetDistance(vectorMe, vectorTarget));

                            if (distance < 150)
                            {
                                if (matrix == null)
                                {
                                    matrix = Memory.Read <System.Numerics.Matrix4x4>(CameraMatrixPointer.ToInt64());
                                }

                                var wts = WorldToScreen(vectorTarget, out OpenTK.Vector3 coords, matrix, Width, Height);
                                if (wts)
                                {
                                    renderItem = new RenderItem();
                                    renderItem.structs.Text       = "rectangle";
                                    renderItem.structs.MapPosX    = coords.X - 2;
                                    renderItem.structs.MapPosZ    = coords.Y - 2;
                                    renderItem.structs.MapPosXend = coords.X + 2;
                                    renderItem.structs.MapPosZend = coords.Y + 2;
                                    renderItem.structs.DrawColor  = Color.Black;
                                    renderItem.structs.Size       = 5;
                                    HelperOpenGL.OverlayGeometry.Add(renderItem);

                                    renderItem = new RenderItem();
                                    renderItem.structs.Text       = "rectangle";
                                    renderItem.structs.MapPosX    = coords.X - 2;
                                    renderItem.structs.MapPosZ    = coords.Y - 2;
                                    renderItem.structs.MapPosXend = coords.X + 2;
                                    renderItem.structs.MapPosZend = coords.Y + 2;
                                    renderItem.structs.DrawColor  = Color.White;
                                    renderItem.structs.Size       = 3;
                                    HelperOpenGL.OverlayGeometry.Add(renderItem);

                                    renderItem = new RenderItem();
                                    renderItem.structs.Text        = HelperOpenGL.LootListToRenderFinal[i].Lootname + " (" + (int)distance + "m)";
                                    renderItem.structs.TextOutline = true;
                                    renderItem.structs.MapPosX     = coords.X;
                                    renderItem.structs.MapPosZ     = coords.Y;
                                    renderItem.structs.DrawColor   = Color.White;
                                    renderItem.structs.Size        = (int)FontSizes.misc;
                                    HelperOpenGL.OverlayText.Add(renderItem);
                                }
                            }
                        }
                    }
                }
            }
            catch
            {
                //// Hmm.... watch live him showing fingers to the cheaters and sucking my dick off... lol... nah jk... my dick is too precious by spoiling it to such abomination.
            }
        }
Example #4
0
        private void PrepareCrossHair()
        {
            // Improvised Crosshair.
            var        crosshairOffset = 8;
            var        crosshairLength = crosshairOffset + 8;
            RenderItem renderItem;

            // CrossHair Main
            // Left
            renderItem = new RenderItem();
            renderItem.structs.Text       = "rectangle";
            renderItem.structs.Size       = 1;
            renderItem.structs.DrawColor  = Color.Fuchsia;
            renderItem.structs.MapPosX    = -crosshairOffset;
            renderItem.structs.MapPosZ    = 0;
            renderItem.structs.MapPosXend = -crosshairLength;
            renderItem.structs.MapPosZend = 0;
            HelperOpenGL.OverlayGeometry.Add(renderItem);

            // Right
            renderItem = new RenderItem();
            renderItem.structs.Text       = "rectangle";
            renderItem.structs.Size       = 1;
            renderItem.structs.DrawColor  = Color.Fuchsia;
            renderItem.structs.MapPosX    = crosshairOffset;
            renderItem.structs.MapPosZ    = 0;
            renderItem.structs.MapPosXend = crosshairLength;
            renderItem.structs.MapPosZend = 0;
            HelperOpenGL.OverlayGeometry.Add(renderItem);

            // Top
            renderItem = new RenderItem();
            renderItem.structs.Text       = "rectangle";
            renderItem.structs.Size       = 1;
            renderItem.structs.DrawColor  = Color.Fuchsia;
            renderItem.structs.MapPosX    = 0;
            renderItem.structs.MapPosZ    = -crosshairOffset;
            renderItem.structs.MapPosXend = 0;
            renderItem.structs.MapPosZend = -crosshairLength;
            HelperOpenGL.OverlayGeometry.Add(renderItem);

            // Bottom
            renderItem = new RenderItem();
            renderItem.structs.Text       = "rectangle";
            renderItem.structs.Size       = 1;
            renderItem.structs.DrawColor  = Color.Fuchsia;
            renderItem.structs.MapPosX    = 0;
            renderItem.structs.MapPosZ    = crosshairOffset;
            renderItem.structs.MapPosXend = 0;
            renderItem.structs.MapPosZend = crosshairLength;
            HelperOpenGL.OverlayGeometry.Add(renderItem);

            // CrossHair Outline
            // Left
            renderItem = new RenderItem();
            renderItem.structs.Text       = "rectangle";
            renderItem.structs.Size       = 1;
            renderItem.structs.DrawColor  = Color.Black;
            renderItem.structs.MapPosX    = -crosshairOffset + 1;
            renderItem.structs.MapPosZ    = -1;
            renderItem.structs.MapPosXend = -crosshairLength - 1;
            renderItem.structs.MapPosZend = 1;
            HelperOpenGL.OverlayGeometry.Add(renderItem);

            // Right
            renderItem = new RenderItem();
            renderItem.structs.Text       = "rectangle";
            renderItem.structs.Size       = 1;
            renderItem.structs.DrawColor  = Color.Black;
            renderItem.structs.MapPosX    = crosshairOffset - 1;
            renderItem.structs.MapPosZ    = -1;
            renderItem.structs.MapPosXend = crosshairLength + 1;
            renderItem.structs.MapPosZend = 1;
            HelperOpenGL.OverlayGeometry.Add(renderItem);

            // Top
            renderItem = new RenderItem();
            renderItem.structs.Text       = "rectangle";
            renderItem.structs.Size       = 1;
            renderItem.structs.DrawColor  = Color.Black;
            renderItem.structs.MapPosX    = -1;
            renderItem.structs.MapPosZ    = -crosshairOffset + 1;
            renderItem.structs.MapPosXend = 1;
            renderItem.structs.MapPosZend = -crosshairLength - 1;
            HelperOpenGL.OverlayGeometry.Add(renderItem);

            // Bottom
            renderItem = new RenderItem();
            renderItem.structs.Text       = "rectangle";
            renderItem.structs.Size       = 1;
            renderItem.structs.DrawColor  = Color.Black;
            renderItem.structs.MapPosX    = -1;
            renderItem.structs.MapPosZ    = crosshairOffset - 1;
            renderItem.structs.MapPosXend = 1;
            renderItem.structs.MapPosZend = crosshairLength + 1;
            HelperOpenGL.OverlayGeometry.Add(renderItem);
        }
Example #5
0
        // Main Draw Cycle it includes the logic that need to be split later on.
        private void GlControl_Map_PrepareObjects()
        {
            /* Here comes all logic that is required before rendering objects
             * we do all calculations here and add everything else and then add it to render list */

            /* X.Y.
             * Left Top ( - | + )
             * Left Bottom ( - | - )
             * Right Top ( + | + )
             * Right Bottom ( + | - )
             */

            // Fix for shoreline, dont know how to make this more beautiful but it`s OK.
            switch (Settings.CurrentMap)
            {
            case "Shoreline":
                openglInvertMap = -1;
                break;

            case "Interchange":
                openglInvertMap = -1;
                break;

            default:
                openglInvertMap = 1;
                break;
            }

            // Fix to keep up with network.
            if (HelperOpenGL.PlayerListToRenderFinal.Count == 0)
            {
                return;
            }

            Helper.myPosXingame = HelperOpenGL.PlayerListToRenderFinal[0].MapLocX;
            Helper.myPosYingame = HelperOpenGL.PlayerListToRenderFinal[0].MapLocY;
            Helper.myPosZingame = HelperOpenGL.PlayerListToRenderFinal[0].MapLocZ;

            var distance = 0f;

            // On Screen Display
            var osdText = new StringBuilder();

            // Render item declare.
            RenderItem renderItem;

            /* The order it goes to openGL
             * From least important to most, includes text. */

            // Check iteration readcomplete open close bools. It must check if true then iterate then close.
            if (Settings.FindLoot)
            {
                GlControl_Map_PrepareObjects_Loot();
            }

            // Check iteration readcomplete open close bools. It must check if true then iterate then close.
            if (mapMarkerDraw)
            {
                renderItem = new RenderItem();
                renderItem.structs.MapPosX   = mapMarkerX;
                renderItem.structs.MapPosZ   = mapMarkerY;
                renderItem.structs.Text      = "loot";
                renderItem.structs.Rotation  = 45;
                renderItem.structs.DrawColor = Color.Yellow;
                HelperOpenGL.OpenglMapIcons.Add(renderItem);

                renderItem = new RenderItem();
                renderItem.structs.MapPosX   = mapMarkerX;
                renderItem.structs.MapPosZ   = mapMarkerY;
                renderItem.structs.Text      = "circlefill";
                renderItem.structs.Size      = 32 * Settings.MapSizeIcon;
                renderItem.structs.DrawColor = Color.FromArgb(64, 255, 255, 0);
                HelperOpenGL.OpenglMapGeometry.Add(renderItem);

                ////glControl_Map_Draw_Circle((float)Settings.Data.map_MapMarkerScanSize * map_ratio, mapMarkerX, mapMarkerY, Color.FromArgb(64, 255, 255, 0));
                ////
                ////int distance = (int)Math.Sqrt(Math.Pow((my_player_coord_real_Y - reversalmapMarkerLocY), 2) + Math.Pow((my_player_coord_real_X - reversalmapMarkerLocX), 2));
                ////glControl_Map_DrawLines(3, my_player_coord_formap_X, my_player_coord_formap_Y, mapMarkerX, mapMarkerY, Color.FromArgb(64, Color.Red));
                ////string distanceString = distance + "m";
                ////glControl_Map_DrawText(distanceString, Color.White, 10, mapMarkerX - 20, mapMarkerY + 30);
            }

            // Map Maker TEMP
            for (int i = 0; i < HelperOpenGL.MapMakerDots.Count; i++)
            {
                var entityPosXingame = HelperOpenGL.MapMakerDots[i].MapLocX;
                var entityPosYingame = HelperOpenGL.MapMakerDots[i].MapLocY;
                var entityPosZingame = HelperOpenGL.MapMakerDots[i].MapLocZ;
                var entityPosXmap    = (entityPosXingame * Settings.MapZoomLevelFromZoomLevels * openglInvertMap) + openglControlMapDragOffsetX;
                var entityPosZmap    = (entityPosZingame * Settings.MapZoomLevelFromZoomLevels * openglInvertMap) + openglControlMapDragOffsetY;
                var entityPosYmap    = entityPosYingame;

                renderItem = new RenderItem();
                renderItem.structs.Text      = "point";
                renderItem.structs.MapPosX   = entityPosXmap;
                renderItem.structs.MapPosZ   = entityPosZmap;
                renderItem.structs.DrawColor = HelperOpenGL.MapMakerDots[i].Drawcolor;
                renderItem.structs.Size      = HelperOpenGL.MapMakerDots[i].Size;
                HelperOpenGL.OpenglMapGeometry.Add(renderItem);
            }

            // Players
            for (int i = 0; i < HelperOpenGL.PlayerListToRenderFinal.Count; i++)
            {
                // Default FOV.
                var lengthFOV = Settings.MapFOVlineOther * Settings.MapZoomLevelFromZoomLevels;

                var entityPosXingame = HelperOpenGL.PlayerListToRenderFinal[i].MapLocX;
                var entityPosYingame = HelperOpenGL.PlayerListToRenderFinal[i].MapLocY;
                var entityPosZingame = HelperOpenGL.PlayerListToRenderFinal[i].MapLocZ;

                // Don`t draw who at 0.0.0
                if (entityPosXingame == 0 || entityPosZingame == 0)
                {
                    continue;
                }

                var entityPosXmap = (entityPosXingame * Settings.MapZoomLevelFromZoomLevels * openglInvertMap) + openglControlMapDragOffsetX;
                var entityPosZmap = (entityPosZingame * Settings.MapZoomLevelFromZoomLevels * openglInvertMap) + openglControlMapDragOffsetY;
                var entityPosYmap = entityPosYingame;

                // Override for OurPlayer.
                if (i == 0)
                {
                    // dot do map maker
                    if (dotDo)
                    {
                        var entityPlayer = new EntityPlayerListRender(
                            "point",
                            Color.Black,
                            1,
                            HelperOpenGL.PlayerListToRenderFinal[i].MapLocX,
                            HelperOpenGL.PlayerListToRenderFinal[i].MapLocY,
                            HelperOpenGL.PlayerListToRenderFinal[i].MapLocZ,
                            0,
                            string.Empty,
                            string.Empty,
                            0,
                            string.Empty,
                            false);

                        HelperOpenGL.MapMakerDots.Add(entityPlayer);
                    }

                    // Inner circle
                    renderItem = new RenderItem();
                    renderItem.structs.Text      = "circle";
                    renderItem.structs.MapPosX   = entityPosXmap;
                    renderItem.structs.MapPosZ   = entityPosZmap;
                    renderItem.structs.DrawColor = Color.FromArgb(255, Color.Red);
                    renderItem.structs.Size      = 100 * Settings.MapZoomLevelFromZoomLevels;
                    HelperOpenGL.OpenglMapGeometry.Add(renderItem);

                    // Medium circle
                    renderItem = new RenderItem();
                    renderItem.structs.Text      = "circle";
                    renderItem.structs.MapPosX   = entityPosXmap;
                    renderItem.structs.MapPosZ   = entityPosZmap;
                    renderItem.structs.DrawColor = Color.FromArgb(255, Color.Green);
                    renderItem.structs.Size      = 200 * Settings.MapZoomLevelFromZoomLevels;
                    HelperOpenGL.OpenglMapGeometry.Add(renderItem);

                    // Outer circle
                    renderItem = new RenderItem();
                    renderItem.structs.Text      = "circle";
                    renderItem.structs.MapPosX   = entityPosXmap;
                    renderItem.structs.MapPosZ   = entityPosZmap;
                    renderItem.structs.DrawColor = Color.FromArgb(255, Color.Red);
                    renderItem.structs.Size      = 300 * Settings.MapZoomLevelFromZoomLevels;
                    HelperOpenGL.OpenglMapGeometry.Add(renderItem);

                    lengthFOV = Settings.MapFOVlineMyself * Settings.MapZoomLevelFromZoomLevels;
                    textBoxMyPosition.Text = entityPosXingame.ToString() + " | " + entityPosYingame.ToString() + " | " + entityPosZingame.ToString();
                }

                /* Classic Way. Leaving for history.
                 * distance = (int)Math.Sqrt(Math.Pow((
                 * ReaderCore.Entities[0].MapLocZ - ReaderCore.Entities[i].MapLocZ), 2) +
                 * Math.Pow((ReaderCore.Entities[0].MapLocX - ReaderCore.Entities[i].MapLocX), 2));
                 */

                Vector3 vectorMe     = new Vector3(Helper.myPosXingame, Helper.myPosZingame, 0);
                Vector3 vectorTarget = new Vector3(entityPosXingame, entityPosZingame, 0);
                Vector3 vectorFOV;

                // Get degress from game for player.
                var degressFOVcenter = HelperOpenGL.PlayerListToRenderFinal[i].MapLocXview;

                // FOV Calculator
                if (openglInvertMap == -1)
                {
                    degressFOVcenter += 180;
                }

                // Correction for negative value.
                if (degressFOVcenter < 0)
                {
                    degressFOVcenter = 360 + degressFOVcenter;
                }

                float degreesFOVleft  = degressFOVcenter - 22;
                float degreesFOVright = degressFOVcenter + 22;

                if (degreesFOVleft < 0)
                {
                    degreesFOVleft = 360 + degreesFOVleft;
                }

                if (degreesFOVright < 0)
                {
                    degreesFOVright = 360 + degreesFOVright;
                }

                // Azimuth for OSD.
                if (Settings.MapOSDShowStats && Settings.MapOSDAzimuth && i == 0)
                {
                    // If i is I am :D
                    osdText.Append("AZT: " + ((int)degressFOVcenter).ToString()).AppendLine().AppendLine();
                }

                // Draw FOV Line.
                // Direction for FOV and angle calculator.
                var fov_line_X = (float)(entityPosXmap + (Math.Cos(((degressFOVcenter * Math.PI) / -180) + (Math.PI / 2)) * lengthFOV));
                var fov_line_Z = (float)(entityPosZmap + (Math.Sin(((degressFOVcenter * Math.PI) / -180) + (Math.PI / 2)) * lengthFOV));
                vectorFOV = new Vector3(fov_line_X, fov_line_Z, 0);

                if (Settings.MapShowPlayerFOV)
                {
                    renderItem = new RenderItem();
                    renderItem.structs.Text       = "linestripple";
                    renderItem.structs.MapPosX    = entityPosXmap;
                    renderItem.structs.MapPosZ    = entityPosZmap;
                    renderItem.structs.MapPosXend = fov_line_X;
                    renderItem.structs.MapPosZend = fov_line_Z;
                    renderItem.structs.DrawColor  = HelperOpenGL.PlayerListToRenderFinal[i].Drawcolor;
                    renderItem.structs.Size       = 2;
                    HelperOpenGL.OpenglMapGeometry.Add(renderItem);

                    renderItem = new RenderItem();
                    renderItem.structs.Text       = "linestripple_invert";
                    renderItem.structs.MapPosX    = entityPosXmap;
                    renderItem.structs.MapPosZ    = entityPosZmap;
                    renderItem.structs.MapPosXend = fov_line_X;
                    renderItem.structs.MapPosZend = fov_line_Z;
                    renderItem.structs.DrawColor  = System.Windows.Forms.ControlPaint.Dark(HelperOpenGL.PlayerListToRenderFinal[i].Drawcolor);
                    renderItem.structs.Size       = 2;
                    HelperOpenGL.OpenglMapGeometry.Add(renderItem);
                }

                distance = (int)Math.Round(Helper.GetDistance(vectorTarget, vectorMe));

                if (i != 0 && Settings.MapShowPlayerDistance)
                {
                    renderItem = new RenderItem();
                    renderItem.structs.Text        = distance + "m";
                    renderItem.structs.MapPosX     = entityPosXmap + 20;
                    renderItem.structs.MapPosZ     = entityPosZmap + 15;
                    renderItem.structs.DrawColor   = Settings.ColorText;
                    renderItem.structs.Size        = (int)FontSizes.misc;
                    renderItem.structs.TextOutline = true;
                    HelperOpenGL.OpenglMapText.Add(renderItem);
                }

                // Draw Player Icon.
                if (Settings.MapShowPlayers)
                {
                    renderItem = new RenderItem();
                    renderItem.structs.Text      = "player";
                    renderItem.structs.MapPosX   = entityPosXmap;
                    renderItem.structs.MapPosZ   = entityPosZmap;
                    renderItem.structs.DrawColor = HelperOpenGL.PlayerListToRenderFinal[i].Drawcolor;
                    renderItem.structs.Rotation  = degressFOVcenter * -1;
                    HelperOpenGL.OpenglMapIcons.Add(renderItem);
                }

                // Draw Player Nickname.
                if (i != 0 && Settings.MapShowPlayerName)
                {
                    switch (HelperOpenGL.PlayerListToRenderFinal[i].Nickname)
                    {
                    case "BOT":
                    case "SCAV":
                        break;

                    default:
                        renderItem = new RenderItem();
                        renderItem.structs.Text        = HelperOpenGL.PlayerListToRenderFinal[i].Nickname;
                        renderItem.structs.MapPosX     = entityPosXmap + 20 + Settings.MapZoomLevelFromZoomLevels;
                        renderItem.structs.MapPosZ     = entityPosZmap;
                        renderItem.structs.DrawColor   = HelperOpenGL.PlayerListToRenderFinal[i].Drawcolor;
                        renderItem.structs.TextOutline = true;
                        renderItem.structs.Size        = (int)FontSizes.misc;
                        HelperOpenGL.OpenglMapText.Add(renderItem);
                        break;
                    }
                }

                // Draw Weapon.
                if (i != 0 && Settings.MapShowPlayerWeapons)
                {
                    renderItem = new RenderItem();
                    renderItem.structs.Text        = HelperOpenGL.PlayerListToRenderFinal[i].Weapon;
                    renderItem.structs.MapPosX     = entityPosXmap + 20 + Settings.MapZoomLevelFromZoomLevels;
                    renderItem.structs.MapPosZ     = entityPosZmap - 15;
                    renderItem.structs.DrawColor   = Settings.ColorText;
                    renderItem.structs.TextOutline = true;
                    renderItem.structs.Size        = (int)FontSizes.misc;
                    HelperOpenGL.OpenglMapText.Add(renderItem);
                }

                // PlayerSide.
                if (i != 0 && Settings.MapShowPlayerSide)
                {
                    renderItem = new RenderItem();
                    renderItem.structs.Text    = "point";
                    renderItem.structs.MapPosX = entityPosXmap - 7 - Settings.MapZoomLevelFromZoomLevels;
                    renderItem.structs.MapPosZ = entityPosZmap + 7 + Settings.MapZoomLevelFromZoomLevels;
                    renderItem.structs.Size    = 5;

                    switch (HelperOpenGL.PlayerListToRenderFinal[i].Side)
                    {
                    case "BEAR":
                        renderItem.structs.DrawColor = Settings.ColorPlayerSideBEAR;
                        HelperOpenGL.OpenglMapGeometry.Add(renderItem);
                        break;

                    case "USEC":
                        renderItem.structs.DrawColor = Settings.ColorPlayerSideUSEC;
                        HelperOpenGL.OpenglMapGeometry.Add(renderItem);
                        break;

                    case "SCAV":
                        renderItem.structs.DrawColor = Settings.ColorPlayerSideSCAV;
                        HelperOpenGL.OpenglMapGeometry.Add(renderItem);
                        break;

                    default:
                        break;
                    }
                }

                // Player Health.
                if (i != 0 && Settings.MapShowPlayerHealth)
                {
                    renderItem = new RenderItem();
                    renderItem.structs.Text        = HelperOpenGL.PlayerListToRenderFinal[i].Health.ToString() + "%";
                    renderItem.structs.TextOutline = true;

                    renderItem.structs.MapPosX   = entityPosXmap + 20;
                    renderItem.structs.MapPosZ   = entityPosZmap - 20;
                    renderItem.structs.DrawColor = Settings.ColorText;
                    renderItem.structs.Size      = (int)FontSizes.misc;
                    HelperOpenGL.OpenglMapText.Add(renderItem);
                }

                // Cheater
                if (HelperOpenGL.PlayerListToRenderFinal[i].Cheater)
                {
                    renderItem = new RenderItem();
                    renderItem.structs.Text      = "circlefill";
                    renderItem.structs.MapPosX   = entityPosXmap;
                    renderItem.structs.MapPosZ   = entityPosZmap;
                    renderItem.structs.DrawColor = Color.FromArgb(128, Color.Red);
                    renderItem.structs.Size      = Settings.MapSizeIcon + 30;
                }

                // Counters for OSD.
                switch (HelperOpenGL.PlayerListToRenderFinal[i].Side)
                {
                case "BEAR":
                case "USEC":
                    reader.PlayerCountPMC++;
                    break;

                default:
                    break;
                }

                // Counters for OSD.
                switch (HelperOpenGL.PlayerListToRenderFinal[i].Nickname)
                {
                case "BOT":
                    reader.PlayerCountBOT++;
                    break;

                case "SCAV":
                    reader.PlayerCountSCAV++;
                    break;

                default:
                    break;
                }
            }

            Settings.FramesPerSecondCounter++;

            //// OSD.

            if (Settings.MapOSDShowStats && Settings.MapOSDPlayerCount)
            {
                osdText.Append(
                    "PMC: " + reader.PlayerCountPMC.ToString()).AppendLine().Append(
                    "SCAV: " + reader.PlayerCountSCAV.ToString()).AppendLine().Append(
                    "BOT: " + reader.PlayerCountBOT.ToString()).AppendLine().Append(
                    "TEAMS: " + Settings.ListTeams.Count).AppendLine().AppendLine();
            }

            if (Settings.MapOSDShowStats)
            {
                osdText.Append(
                    "ZOOM: " + Settings.MapZoomLevelFromZoomLevels.ToString()).AppendLine();
            }

            if (Settings.MapOSDShowStats && Settings.MapOSDFPS)
            {
                osdText.Append(
                    "FPS: " + Settings.FramerPerSecondOSD).AppendLine();
            }

            if (Settings.MapOSDShowStats && Settings.MapOSDReadCalls)
            {
                osdText.Append(
                    "RPM/TICK: " + Memory.RPMCount).AppendLine();
            }

            if (Settings.MapOSDShowStats && Settings.MapOSDDateTime)
            {
                osdText.Append(DateTime.Now.ToString("HH:mm:ss fff"));
            }

            Memory.RPMCount = 0;

            if ((DateTime.Now - Settings.FramesPerSecondTime).Seconds > 1)
            {
                Settings.FramerPerSecondOSD     = Settings.FramesPerSecondCounter;
                Settings.FramesPerSecondTime    = DateTime.Now;
                Settings.FramesPerSecondCounter = 0;
            }

            renderItem = new RenderItem();
            renderItem.structs.Text        = osdText.ToString();
            renderItem.structs.TextOutline = true;

            renderItem.structs.MapPosX   = -(openglControlMap.Width / 2) + 10;
            renderItem.structs.MapPosZ   = (openglControlMap.Height / 2) - 10;
            renderItem.structs.DrawColor = Settings.ColorOSD;
            renderItem.structs.Size      = (int)FontSizes.misc;
            HelperOpenGL.OpenglMapText.Add(renderItem);
        }
Example #6
0
        private void GlControl_Map_PrepareObjects_Loot()
        {
            if (findLootListClear)
            {
                if (findLootListClearLootItems)
                {
                    Settings.LootListToLookFor.Clear();
                }

                Settings.LootListForListView.Clear();
                findLootListClear = !findLootListClear;
            }

            RenderItem renderItem;

            for (int i = 0; i < HelperOpenGL.LootListToRenderFinal.Count; i++)
            {
                var lootPosXoriginal = HelperOpenGL.LootListToRenderFinal[i].MapLocX * openglInvertMap;
                var lootPosYoriginal = HelperOpenGL.LootListToRenderFinal[i].MapLocY * openglInvertMap;
                var lootPosZoriginal = HelperOpenGL.LootListToRenderFinal[i].MapLocZ * openglInvertMap;

                var lootPosXmap = (lootPosXoriginal * Settings.MapZoomLevelFromZoomLevels) + openglControlMapDragOffsetX;
                var lootPosZmap = (lootPosZoriginal * Settings.MapZoomLevelFromZoomLevels) + openglControlMapDragOffsetY;
                var lootPosYmap = lootPosYoriginal;

                renderItem = new RenderItem();
                renderItem.structs.MapPosX = lootPosXmap;
                renderItem.structs.MapPosZ = lootPosZmap;

                switch (HelperOpenGL.LootListToRenderFinal[i].Lootname)
                {
                case "lootable":
                case "box_Weapon_110x45":
                case "box_Weapon_64":
                case "box_GunSafe":
                case "box_WeaponBox":
                    renderItem.structs.Text      = "tentbox";
                    renderItem.structs.DrawColor = Settings.ColorMilitaryCrate;
                    HelperOpenGL.OpenglMapIcons.Add(renderItem);
                    break;

                case "box_Weapon_140":
                    renderItem.structs.Text      = "tentbox";
                    renderItem.structs.DrawColor = Settings.ColorMilitaryCrateLong;
                    HelperOpenGL.OpenglMapIcons.Add(renderItem);
                    break;

                case "box_Ammo":
                    renderItem.structs.Text      = "tentbox";
                    renderItem.structs.DrawColor = Settings.ColorMilitaryCrateAmmo;
                    HelperOpenGL.OpenglMapIcons.Add(renderItem);
                    break;

                case "box_Grenades":
                    renderItem.structs.Text      = "tentbox";
                    renderItem.structs.DrawColor = Settings.ColorMilitaryCrateGrenades;
                    HelperOpenGL.OpenglMapIcons.Add(renderItem);
                    break;

                case "Corpse":
                    renderItem.structs.Text      = "npc_dead";
                    renderItem.structs.DrawColor = Settings.ColorCorpse;
                    HelperOpenGL.OpenglMapIcons.Add(renderItem);
                    break;

                default:
                    renderItem.structs.Text      = "loot";
                    renderItem.structs.DrawColor = Settings.ColorLoot;
                    HelperOpenGL.OpenglMapIcons.Add(renderItem);

                    renderItem = new RenderItem();
                    renderItem.structs.MapPosX     = lootPosXmap + 10 + Settings.MapZoomLevelFromZoomLevels;
                    renderItem.structs.MapPosZ     = lootPosZmap + 8;
                    renderItem.structs.Text        = HelperOpenGL.LootListToRenderFinal[i].Lootname;
                    renderItem.structs.DrawColor   = System.Windows.Forms.ControlPaint.Light(Settings.ColorLoot);
                    renderItem.structs.Size        = (int)FontSizes.misc;
                    renderItem.structs.TextOutline = true;
                    HelperOpenGL.OpenglMapText.Add(renderItem);
                    break;
                }
            }

            if (Settings.FindLootRebuildTable)
            {
                Settings.FindLootRebuildTable = false;

                olvLootList.BuildList();
                Olv_ParseEntries();
            }
        }