コード例 #1
0
        private static void Postfix(BeatmapSaveDataVersion2_6_0AndEarlier.BeatmapSaveData.ObstacleType obstacleType, ref int __result)
        {
            if ((int)obstacleType >= 1000 && (int)obstacleType <= 4000 || (int)obstacleType >= 4001 && (int)obstacleType <= 4005000)
            {
                Mode mode        = (int)obstacleType >= 4001 && (int)obstacleType <= 4100000 ? Mode.preciseHeightStart : Mode.preciseHeight;
                var  startHeight = 0;
                var  value       = (int)obstacleType;
                if (mode == Mode.preciseHeightStart)
                {
                    value      -= 4001;
                    startHeight = value % 1000;
                }
                // Painful math behind this layer calculation logic:
                // https://media.discordapp.net/attachments/864240224400572467/952764516956004372/unknown.png
                // It's probably not 100% accurate but should be enough in most cases.

                //float layer = 6.3333f * startHeight + 833.333f;
                //if (layer >= 1000)
                //{
                //    layer += 446;
                //    layer *= 1.05f;
                //    __result = (int)layer;
                //}
                //else
                //{
                //    __result = 1000;
                //}

                // Alternative Math that is similarly accurate in shape/proportions but has walls being too high.
                float layer = startHeight / 750f * 5f;
                layer    = layer * 1000 + 1334;
                __result = (int)layer;
            }
        }
コード例 #2
0
 private static void Postfix(BeatmapSaveDataVersion2_6_0AndEarlier.BeatmapSaveData.ObstacleType obstacleType, ref int __result)
 {
     if ((int)obstacleType >= 1000 && (int)obstacleType <= 4000 || (int)obstacleType >= 4001 && (int)obstacleType <= 4005000)
     {
         Mode mode = (int)obstacleType >= 4001 && (int)obstacleType <= 4100000 ? Mode.preciseHeightStart : Mode.preciseHeight;
         int  obsHeight;
         var  value = (int)obstacleType;
         if (mode == Mode.preciseHeightStart)
         {
             value    -= 4001;
             obsHeight = value / 1000;
         }
         else
         {
             obsHeight = value - 1000;
         }
         float height = obsHeight / 1000f * 5f;
         height   = height * 1000 + 1000;
         __result = (int)height;
     }
 }