Esempio n. 1
0
        public void MainThreadHook(On.Celeste.AutoSplitterInfo.orig_Update orig, AutoSplitterInfo self)
        {
            orig(self);

            if (AreaHandoff != null)
            {
                AreaData.Areas.Add(AreaHandoff);
                AreaHandoff = null;
            }
        }
        private void MainThreadHook(On.Celeste.AutoSplitterInfo.orig_Update orig, AutoSplitterInfo self)
        {
            orig(self);

            if (AreaHandoff != null)
            {
                AreaData.Areas.Add(AreaHandoff);
                var key = new AreaKey(AreaData.Areas.Count - 1); // does this trigger some extra behavior
                AreaHandoff = null;
            }
            if (StartMe != null && !Entering)
            {
                var newArea = StartMe.Value;
                Audio.SetMusic((string)null, true, true);
                Audio.SetAmbience((string)null, true);
                Audio.Play("event:/ui/main/savefile_begin");

                // use the debug file
                SaveData.InitializeDebugMode();
                // turn on/off variants mode
                SaveData.Instance.VariantMode = Settings.Variants;
                SaveData.Instance.AssistMode  = false;
                // mark as completed to spawn golden berry
                SaveData.Instance.Areas[newArea.ID].Modes[0].Completed = true;
                // mark heart as not collected
                SaveData.Instance.Areas[newArea.ID].Modes[0].HeartGem = false;
                Entering = true;

                var fade = new FadeWipe(Engine.Scene, false, () => {   // assign to variable to suppress compiler warning
                    var session = new Session(newArea, null, null)
                    {
                        FirstLevel           = true,
                        StartedFromBeginning = true,
                    };
                    session.SeedCleanRandom(Settings.SeedType == SeedType.Random);
                    SaveData.Instance.StartSession(session);    // need to set this earlier than we would get otherwise
                    LevelEnter.Go(session, true);
                    StartMe  = null;
                    Entering = false;
                });

                /*foreach (AreaData area in AreaData.Areas) {
                 *  Logger.Log("randomizer", $"Skeleton for {area.GetSID()}");
                 *  RandoConfigFile.YamlSkeleton(area);
                 *
                 * }*/
            }
        }
        private void MainThreadHook(On.Celeste.AutoSplitterInfo.orig_Update orig, AutoSplitterInfo self)
        {
            orig(self);

            if (AreaHandoff != null)
            {
                if (AreaHandoff.ID < AreaData.Areas.Count)
                {
                    AreaData.Areas[AreaHandoff.ID] = AreaHandoff;
                }
                else if (AreaHandoff.ID == AreaData.Areas.Count)
                {
                    AreaData.Areas.Add(AreaHandoff);
                }
                else
                {
                    throw new Exception("Strange edge case in the randomizer, please report this bug");
                }
                var unused = new AreaKey(AreaData.Areas.Count - 1); // does this trigger some extra behavior
                AreaHandoff = null;
            }
            if (StartMe != null && !Entering)
            {
                var newArea = StartMe.Value;

                var area         = AreaData.Get(newArea);
                var dyn          = new DynData <AreaData>(area);
                var areaSettings = dyn.Get <RandoSettings>("RandoSettings");
                Audio.SetMusic(null);
                Audio.SetAmbience(null);
                Audio.Play("event:/ui/main/savefile_begin");

                // use the debug file
                SaveData.InitializeDebugMode();
                // turn on/off variants mode
                SaveData.Instance.VariantMode = areaSettings.Variants;
                SaveData.Instance.AssistMode  = false;
                // mark as completed to spawn golden berry
                SaveData.Instance.Areas[newArea.ID].Modes[0].Completed = true;
                // mark heart as not collected
                SaveData.Instance.Areas[newArea.ID].Modes[0].HeartGem = false;
                Entering = true;

                var unused = new FadeWipe(Engine.Scene, false, () => {   // assign to variable to suppress compiler warning
                    Session session;
                    if (UseSession != null)
                    {
                        session    = UseSession;
                        UseSession = null;
                    }
                    else
                    {
                        session = new Session(newArea)
                        {
                            FirstLevel           = true,
                            StartedFromBeginning = true,
                        };
                        session.SeedCleanRandom(Settings.SeedType == SeedType.Random);
                    }
                    SaveData.Instance.StartSession(session);    // need to set this earlier than we would get otherwise
                    StartMe  = null;
                    Entering = false;
                    LevelEnter.Go(session, true);
                });

                /*foreach (AreaData area in AreaData.Areas) {
                 *  Logger.Log("randomizer", $"Skeleton for {area.GetSID()}");
                 *  RandoConfigFile.YamlSkeleton(area);
                 *
                 * }*/
            }

            // update endless mode score
            var settings = (Engine.Scene is AreaComplete) ? this.endingSettings : this.InRandomizerSettings;

            if (settings != null && settings.Algorithm == LogicType.Endless)
            {
                this.CurrentScore = ComputeScore(settings);
            }
            else
            {
                this.CurrentScore = -1;
            }
        }
Esempio n. 4
0
 public void wtf(On.Celeste.AutoSplitterInfo.orig_Update orig, AutoSplitterInfo self)
 {
     orig(self);
 }