Skip to content

Commit 44350f9

Browse files
committed
Revert "Merge pull request #999 from SnipUndercover/dialog-cutscene-changes"
This reverts commit 908a021, reversing changes made to cb802a1.
1 parent 908a021 commit 44350f9

File tree

1 file changed

+9
-46
lines changed

1 file changed

+9
-46
lines changed
Lines changed: 9 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,40 @@
1-
using Microsoft.Xna.Framework;
2-
using Monocle;
1+
using Microsoft.Xna.Framework;
32

43
namespace Celeste.Mod.Entities {
5-
[Tracked]
64
[CustomEntity("everest/dialogTrigger", "dialog/dialogtrigger", "cavern/dialogtrigger")]
75
public class DialogCutsceneTrigger : Trigger {
86

97
private string dialogEntry;
108
private bool triggered;
119
private EntityID id;
12-
private bool noRespawnAfterUse;
13-
private bool triggerOnlyOnce;
14-
private bool ignoreIntroState;
10+
private bool onlyOnce;
1511
private bool endLevel;
1612
private int deathCount;
1713

1814
public DialogCutsceneTrigger(EntityData data, Vector2 offset, EntityID entId)
1915
: base(data, offset) {
2016
dialogEntry = data.Attr("dialogId");
21-
noRespawnAfterUse = data.Bool("onlyOnce", true); // don't rename the EntityData name for backwards compat
22-
triggerOnlyOnce = data.Bool("triggerOnlyOnce", true);
23-
ignoreIntroState = data.Bool("ignoreIntroState", false);
17+
onlyOnce = data.Bool("onlyOnce", true);
2418
endLevel = data.Bool("endLevel", false);
2519
deathCount = data.Int("deathCount", -1);
2620
triggered = false;
2721
id = entId;
2822
}
2923

30-
// do not remove OnEnter! doing so will break maps that rely on third-party triggers to start dialog cutscenes.
31-
// vanilla naturally calls OnEnter and OnStay in the same frame when entering the trigger,
32-
// which would mean that we don't need the OnEnter method.
33-
// however, sj's "in filtration" uses a Trigger Trigger (CrystallineHelper) to start a dialog cutscene;
34-
// it only calls OnEnter and not OnStay, so removing OnEnter will make the dialog not appear and cause a tas desync!
3524
public override void OnEnter(Player player) {
36-
TriggerCutscene(player);
37-
}
38-
39-
public override void OnStay(Player player) {
40-
TriggerCutscene(player);
41-
}
42-
43-
public override void OnLeave(Player player) {
44-
if (!triggerOnlyOnce)
45-
triggered = false;
46-
}
47-
48-
private void TriggerCutscene(Player player) {
49-
if (Scene is not Level level)
50-
return;
51-
52-
if (triggered)
53-
return;
54-
55-
if (deathCount >= 0 && level.Session.DeathsInCurrentLevel != deathCount)
56-
return;
57-
58-
if (ignoreIntroState && ((patch_Player) player).IsIntroState)
59-
return;
25+
if (triggered || (Scene as Level).Session.GetFlag("DoNotLoad" + id) ||
26+
(deathCount >= 0 && SceneAs<Level>().Session.DeathsInCurrentLevel != deathCount)) {
6027

61-
// don't activate if some dialog is already in progress
62-
if (level.Tracker.GetEntity<Textbox>() is not null)
6328
return;
29+
}
6430

6531
triggered = true;
6632

6733
Scene.Add(new DialogCutscene(dialogEntry, player, endLevel));
6834

69-
if (noRespawnAfterUse) {
70-
// this flag is unused in vanilla and Everest, but mods may still make use of it,
71-
// so it remains here for backwards compatibility
72-
level.Session.SetFlag("DoNotLoad" + id, true);
73-
level.Session.DoNotLoad.Add(id);
74-
}
35+
if (onlyOnce)
36+
(Scene as Level).Session.SetFlag("DoNotLoad" + id, true); // Sets flag to not load
7537
}
38+
7639
}
7740
}

0 commit comments

Comments
 (0)