Skip to content

Commit

Permalink
Improvements for cassette music maps
Browse files Browse the repository at this point in the history
  • Loading branch information
Vexatos committed Dec 3, 2021
1 parent 8cb5b5e commit 24adfde
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Celeste.Mod.mm/Mod/Meta/MapMeta.cs
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,7 @@ public MapMetaCassetteModifier(BinaryPacker.Element meta) {
public int TicksPerSwap { get; set; } = 2;
public int Blocks { get; set; } = 2;
public int BeatsMax { get; set; } = 256;
public int BeatIndexOffset { get; set; } = 0;
public bool OldBehavior { get; set; } = false;

public void Parse(BinaryPacker.Element meta) {
Expand All @@ -536,6 +537,7 @@ public void Parse(BinaryPacker.Element meta) {
meta.AttrIfInt("TicksPerSwap", v => TicksPerSwap = v);
meta.AttrIfInt("Blocks", v => Blocks = v);
meta.AttrIfInt("BeatsMax", v => BeatsMax = v);
meta.AttrIfInt("BeatIndexOffset", v => BeatIndexOffset = v);
meta.AttrIfBool("OldBehavior", v => OldBehavior = v);
}
}
Expand Down
3 changes: 2 additions & 1 deletion Celeste.Mod.mm/Patches/CassetteBlockManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public override void Awake(Scene scene) {
beatsPerTick = meta.BeatsPerTick;
ticksPerSwap = meta.TicksPerSwap;
beatIndexMax = meta.BeatsMax;
beatIndexOffset = meta.BeatIndexOffset;
}
}

Expand Down Expand Up @@ -114,7 +115,7 @@ public override void Awake(Scene scene) {
maxBeat = level.CassetteBlockBeats;
tempoMult = level.CassetteBlockTempo;

if (beatIndex % 8 >= 5) {
if (beatIndex % (beatsPerTick * ticksPerSwap) > ((beatsPerTick * ticksPerSwap) / 2)) {
currentIndex = maxBeat - 2;
} else {
currentIndex = maxBeat - 1;
Expand Down

0 comments on commit 24adfde

Please sign in to comment.