Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for replay mods #2400

Merged
merged 7 commits into from Apr 18, 2018

Conversation

3 participants
@tgi74
Copy link
Contributor

tgi74 commented Apr 13, 2018

Adds a way to convert a mod enum to Mod objects, then bind them to the player Mods

tgi74 added some commits Apr 13, 2018

@@ -194,6 +194,7 @@ protected void LoadScore(Score s)
}

Beatmap.Value = BeatmapManager.GetWorkingBeatmap(s.Beatmap);
Beatmap.Value.Mods.BindTo(new Bindable<IEnumerable<Mod>>(s.Mods));

This comment has been minimized.

@peppy

peppy Apr 15, 2018

Member

You probably don't want this to be a BindTo, but just a set.

@peppy peppy added this to the Candidate Issues milestone Apr 16, 2018

@peppy peppy added replay mods labels Apr 16, 2018

@@ -33,6 +34,8 @@ public IEnumerable<Mod> GetAllMods() => Enum.GetValues(typeof(ModType)).Cast<Mod

public abstract IEnumerable<Mod> GetModsFor(ModType type);

public abstract IEnumerable<Mod> GetLegacyModsFor(LegacyMods mods);

This comment has been minimized.

@smoogipoo

smoogipoo Apr 16, 2018

Contributor
  • Virtual, not abstract.
  • Rename to ConvertLegacyMods.
  • xmldoc something like Converts mods from legacy enum values. Do not override if you're not a legacy ruleset.
Key1 = 67108864,
Key3 = 134217728,
Key2 = 268435456,
}

This comment has been minimized.

@smoogipoo

smoogipoo Apr 16, 2018

Contributor

Use the following instead:

[Flags]
public enum Mods
{
    None                   = 0,
    NoFail                 = 1 << 0,
    Easy                   = 1 << 1,
    TouchDevice            = 1 << 2,
    Hidden                 = 1 << 3,
    HardRock               = 1 << 4,
    SuddenDeath            = 1 << 5,
    DoubleTime             = 1 << 6,
    Relax                  = 1 << 7,
    HalfTime               = 1 << 8,
    Nightcore              = 1 << 9,
    Flashlight             = 1 << 10,
    Autoplay               = 1 << 11,
    SpunOut                = 1 << 12,
    Relax2                 = 1 << 13,
    Perfect                = 1 << 14,
    Key4                   = 1 << 15,
    Key5                   = 1 << 16,
    Key6                   = 1 << 17,
    Key7                   = 1 << 18,
    Key8                   = 1 << 19,
    FadeIn                 = 1 << 20,
    Random                 = 1 << 21,
    Cinema                 = 1 << 22,
    Target                 = 1 << 23,
    Key9                   = 1 << 24,
    KeyCoop                = 1 << 25,
    Key1                   = 1 << 26,
    Key3                   = 1 << 27,
    Key2                   = 1 << 28,
}
yield return new CatchModNightcore();
else if (mods.HasFlag(LegacyMods.DoubleTime))
yield return new CatchModDoubleTime();

This comment has been minimized.

@smoogipoo

smoogipoo Apr 16, 2018

Contributor

Extra newline.

yield return new OsuModNightcore();
else if (mods.HasFlag(LegacyMods.DoubleTime))
yield return new OsuModDoubleTime();

This comment has been minimized.

@smoogipoo

smoogipoo Apr 16, 2018

Contributor

Extra newline.

tgi74 and others added some commits Apr 16, 2018

@smoogipoo

This comment has been minimized.

Copy link
Contributor

smoogipoo commented Apr 18, 2018

Looks good to me 👍

@peppy peppy merged commit 919f2ac into ppy:master Apr 18, 2018

1 check passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.