Exemple #1
0
 private static Point GetCharacterImagePosition(Point mapPos, int c) => MapSelectionRenderer.GetCharacterImagePosition(mapPos.X, mapPos.Y, c);
Exemple #2
0
        public static void DrawObjectsAndHitBoxes()
        {
            var allObjects    = MapSelectionRenderer.CurrentMap.MapObjects.MapObjects;
            var sortedObjects = MapEditor.Rendering.MapRenderer.RendSort(allObjects);

            foreach (var mapObject in sortedObjects)
            {
                try
                {
                    var levelIndex    = mapObject.Level;
                    var mapObjectPage = mapObject.Pages.SelectedEventPage;
                    if (mapObjectPage == null)
                    {
                        continue;
                    }
                    var zPosition = MapSelectionRenderer.GetCPosition(mapObject.Level);

                    var renderPass        = RenderPassPadding * ((MapSelectionRenderer.CurrentMap.Header.Levels - mapObject.Level) * 2) + mapObjectPage.RendType;
                    var mapObjectPosition = MapSelectionRenderer.GetImagePosition(mapObject.MapPosition, zPosition);

                    // Objects
                    if (!mapObjectPage.IsCharacter)
                    {
                        mapObjectPosition = MapSelectionRenderer.GetCharacterImagePosition(mapObject.MapPosition, zPosition);
                        MapSelectionRenderer.MapRenderer.Draw(new Sprite
                        {
                            Position = mapObjectPosition,
                            TexX     = mapObjectPage.TexX,
                            TexY     = mapObjectPage.TexY,
                            Width    = mapObjectPage.TexW,
                            Height   = mapObjectPage.TexH,
                            Texture  = $"body{mapObjectPage.GraphicsIndex}"
                        }, renderPass);
                    }
                    else
                    {
                        bool reversed = mapObjectPage.Angle == 3 || mapObjectPage.Angle == 7;
                        var  noShadow = CharacterInfo.IsNoShadowCharacter(mapObjectPage.GraphicsIndex, mapObjectPage.CharacterIndex);
                        if (!noShadow)
                        {
                            var shadowPosition = mapObjectPosition;
                            shadowPosition.Offset(0, -16);
                            MapSelectionRenderer.MapRenderer.Draw(new Sprite
                            {
                                Position = shadowPosition,
                                TexX     = 0,
                                TexY     = 384,
                                Width    = 32,
                                Height   = 48,
                                Texture  = $"charachip1"
                            }, renderPass - 1);
                        }

                        mapObjectPosition.Offset(0, -40);
                        MapSelectionRenderer.MapRenderer.Draw(new Sprite
                        {
                            Position = mapObjectPosition,
                            TexX     = mapObjectPage.TexX,
                            TexY     = mapObjectPage.TexY,
                            Width    = 64,
                            Height   = 96,
                            Texture  = $"charachip{mapObjectPage.GraphicsIndex}",
                            Scale    = new Vector2(reversed ? -1 : 1, 1)
                        }, renderPass);
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine($"{e.GetType().ToString()}: {e.Message}");
                }
            }
        }