private static void ModifyRoomCamera(On.Terraria.Main.orig_ClampScreenPositionToWorld orig)
        {
            if (!DungeonSubworld.inDungeon)
            {
                orig();
                return;
            }


            var chunk = Main.LocalPlayer.GetCurrentChunk();

            Vector2 playerChunk = chunk.Position;

            Rectangle roomBound = new Rectangle((int)playerChunk.X * 16, (int)playerChunk.Y * 16, 100 * 16, 75 * 16);
            //DynamicDungeon.instance.Logger.Debug(roomBound);
            //DynamicDungeon.instance.Logger.Debug($"Current dungeon room bound: {roomBound}");

            Vector2 vector  = new Vector2(roomBound.X, roomBound.Y);
            Vector2 vector2 = new Vector2(roomBound.X + roomBound.Width, roomBound.Y + roomBound.Height);

            vector   = Utils.Round(vector);
            vector2  = Utils.Round(vector2);
            vector2 *= -1f;
            //DynamicDungeon.instance.Logger.Debug($"Current dungeon room top left : {vector}");
            //DynamicDungeon.instance.Logger.Debug($"Current dungeon room bottom left : {vector2}");
            //DynamicDungeon.instance.Logger.Debug($"Current player chunk position : {playerChunk}");
            Main.screenPosition = roomBound.Center() - new Vector2(Main.screenWidth / 2f, Main.screenHeight / 2f);
        }
예제 #2
0
 private static void Main_ClampScreenPositionToWorld(On.Terraria.Main.orig_ClampScreenPositionToWorld orig)
 {
     Main.screenPosition.X = (int)(Main.screenPosition.X + (Main.mouseX - (Main.screenWidth / 2)) / Value);
     Main.screenPosition.Y = (int)(Main.screenPosition.Y + (Main.mouseY - (Main.screenHeight / 2)) / Value);
 }
예제 #3
0
 private static void OnClampScreenPositionToWorld(On.Terraria.Main.orig_ClampScreenPositionToWorld orig)
 {
     return;
 }