Beispiel #1
0
        private static void DecodeChartVenue(SongData song, QbFile qbchart, NoteChart chart)
        {
            QbItemArray cameraitems = qbchart.FindItem(QbKey.Create(song.ID + "_cameras_notes"), false) as QbItemArray;

            if (cameraitems != null && cameraitems.Items.Count > 0)
            {
                cameraitems = cameraitems.Items[0] as QbItemArray;
            }
            if (cameraitems != null)
            {
                Random random = new Random();
                foreach (QbItemInteger camera in cameraitems.Items)
                {
                    uint            time  = camera.Values[0];
                    NoteChart.Point point = new NoteChart.Point(chart.GetTicks(camera.Values[0]));

                    if (random.Next() % 9 == 0)
                    {
                        chart.Venue.DirectedShots.Add(new Pair <NoteChart.Point, NoteChart.VenueTrack.DirectedCut>(point, NoteChart.VenueTrack.DirectedCut.None));
                    }
                    else
                    {
                        chart.Venue.CameraShots.Add(new Pair <NoteChart.Point, NoteChart.VenueTrack.CameraShot>(point, new NoteChart.VenueTrack.CameraShot()));
                    }
                }
            }

            QbItemArray crowditems = qbchart.FindItem(QbKey.Create(song.ID + "_crowd_notes"), false) as QbItemArray;

            if (crowditems != null && crowditems.Items.Count > 0)
            {
                crowditems = crowditems.Items[0] as QbItemArray;
            }
            if (crowditems != null)
            {
                foreach (QbItemInteger crowd in crowditems.Items)
                {
                    NoteChart.Point point = new NoteChart.Point(chart.GetTicks(crowd.Values[0]));
                    chart.Events.Crowd.Add(new Pair <NoteChart.Point, NoteChart.EventsTrack.CrowdType>(point, NoteChart.EventsTrack.CrowdType.None));
                }
            }

            QbItemArray lightitems = qbchart.FindItem(QbKey.Create(song.ID + "_lightshow_notes"), false) as QbItemArray;

            if (lightitems != null && lightitems.Items.Count > 0)
            {
                lightitems = lightitems.Items[0] as QbItemArray;
            }
            if (lightitems != null)
            {
                foreach (QbItemInteger light in lightitems.Items)
                {
                    NoteChart.Point point = new NoteChart.Point(chart.GetTicks(light.Values[0]));
                    chart.Venue.Lighting.Add(new Pair <NoteChart.Point, NoteChart.VenueTrack.LightingType>(point, NoteChart.VenueTrack.LightingType.None));
                }
            }
        }
Beispiel #2
0
        public static void DecodeDrums(NoteChart chart, Midi midi, bool gh1)
        {
            chart.PartDrums = new NoteChart.Drums(chart);

            Midi.Track track;
            if (gh1)
            {
                track = midi.GetTrack("TRIGGERS");
            }
            else
            {
                track = midi.GetTrack("BAND DRUMS");
            }

            foreach (Midi.NoteEvent note in track.Notes)
            {
                switch (note.Note)
                {
                case 60:
                case 36:                         // Kick
                    chart.PartDrums.Gems[NoteChart.Difficulty.Expert][0].Add(new NoteChart.Note(note));
                    break;

                case 61:
                case 37:                         // Crash
                    chart.PartDrums.Gems[NoteChart.Difficulty.Expert][4].Add(new NoteChart.Note(note));
                    break;

                case 0x30:
                case 0x31:
                case 0x40:
                case 0x41:
                    break;
                }
            }

            if (gh1)
            {
                track = midi.GetTrack("EVENTS");
            }

            Midi.TextEvent previouscomment = new Midi.TextEvent(0, "[nobeat]");
            string         previoustext    = "nobeat";

            foreach (var comment in track.Comments)
            {
                NoteChart.Point note = new NoteChart.Point(comment.Time);

                string text = comment.Text.Trim('[', ']', ' ');

                if (gh1)
                {
                    if (text.StartsWith("drum_"))
                    {
                        text = text.Substring(5);
                    }
                    else
                    {
                        continue;
                    }
                }

                switch (text)
                {
                case "idle":
                case "off":
                case "noplay":
                    chart.PartDrums.CharacterMoods.Add(new Pair <NoteChart.Point, NoteChart.CharacterMood>(note, NoteChart.CharacterMood.Idle));
                    break;

                case "play":
                case "normal":
                case "on":
                    chart.PartDrums.CharacterMoods.Add(new Pair <NoteChart.Point, NoteChart.CharacterMood>(note, NoteChart.CharacterMood.Play));
                    previouscomment = comment;
                    break;

                default:
                    ulong duration = comment.Time - previouscomment.Time;
                    ulong time     = previouscomment.Time;
                    float fraction = 0;
                    switch (previoustext)
                    {
                    case "on":
                    case "allplay":
                    case "play":
                    case "allbeat":
                    case "allbreat":
                    case "all_beat":
                    case "normal":
                    case "norm":
                    case "nomral":
                    case "normal_tempo":
                        fraction = 1;
                        break;

                    case "off":
                    case "noplay":
                    case "nobeat":
                    case "no_beat":
                        fraction = 0;
                        break;

                    case "double":
                    case "double_time":
                    case "doubletime":
                    case "double_tempo":
                    case "doulbe_time":
                        fraction = 0.5f;
                        break;

                    case "half":
                    case "half_time":
                    case "halftime":
                    case "half_tempo":
                        fraction = 2;
                        break;
                    }
                    if (fraction > 0)
                    {
                        while (time < comment.Time)
                        {
                            chart.PartDrums.Gems[NoteChart.Difficulty.Expert][(previoustext == "play" || previoustext == "normal") ? 2 : 1].Add(new NoteChart.Note(time));

                            time += (ulong)(midi.Division.TicksPerBeat * fraction);
                        }
                    }
                    previouscomment = comment;
                    previoustext    = text;
                    break;
                }
            }

            ChartFormatGH5.FillSections(chart, 1, 8, 1, chart.PartDrums.Overdrive, null);
            ChartFormatGH5.FillSections(chart, 1, 4, 3, chart.PartDrums.DrumFills, null);
        }
Beispiel #3
0
        public bool PopulateChart(SongData song, NoteChart chart)
        {
            if (Root == null)
            {
                return(false);
            }

            string idprefix = string.Empty;

            bool ret = false;

            foreach (XmlElement node in Root.GetElementsByTagName("global"))
            {
                foreach (XmlElement element in node.GetElementsByTagName("idprefix"))
                {
                    idprefix = element.InnerText;
                }
            }

            string songid = song.ID;

            if (songid.StartsWith(idprefix))
            {
                songid = songid.Substring(idprefix.Length);
            }

            List <SoloInfo> solos = new List <SoloInfo>();

            foreach (XmlElement element in Root.GetElementsByTagName("song"))
            {
                if (element.Attributes["game"] != null && int.Parse(element.Attributes["game"].Value) != (int)Game)
                {
                    continue;
                }

                if (string.Compare(element.Attributes["id"].Value, songid, true) == 0)
                {
                    foreach (XmlElement soloelement in element.GetElementsByTagName("solo"))
                    {
                        string     startsection = soloelement.Attributes["start"] != null ? soloelement.Attributes["start"].Value : string.Empty;
                        string     endsection   = soloelement.Attributes["end"] != null ? soloelement.Attributes["end"].Value : startsection;
                        float      startoffset  = float.Parse(soloelement.Attributes["startoffset"] != null ? soloelement.Attributes["startoffset"].Value : "0");
                        float      endoffset    = float.Parse(soloelement.Attributes["endoffset"] != null ? soloelement.Attributes["endoffset"].Value : "0");
                        Instrument instrument   = soloelement.Attributes["instrument"] != null?Platform.InstrumentFromString(soloelement.Attributes["instrument"].Value) : Instrument.Guitar;

                        if (!startsection.HasValue())
                        {
                            continue;
                        }

                        NoteChart.Point start    = new NoteChart.Point(chart.Events.Sections.Find(e => string.Compare(e.Value, startsection, true) == 0).Key.Time);
                        int             endindex = chart.Events.Sections.FindIndex(e => string.Compare(e.Value, endsection, true) == 0);
                        NoteChart.Point end;
                        if (endindex + 1 < chart.Events.Sections.Count)
                        {
                            end = new NoteChart.Point(chart.Events.Sections[endindex + 1].Key.Time);
                        }
                        else
                        {
                            end = new NoteChart.Point(chart.Events.End.Time);
                        }

                        start.Time += (ulong)(startoffset * (float)chart.Division.TicksPerBeat);
                        end.Time   += (ulong)(endoffset * (float)chart.Division.TicksPerBeat);

                        NoteChart.Note note = new NoteChart.Note(start.Time, end.Time - start.Time);

                        if (instrument == Instrument.Guitar)
                        {
                            chart.PartGuitar.SoloSections.Add(note);
                        }
                        else if (instrument == Instrument.Bass)
                        {
                            chart.PartBass.SoloSections.Add(note);
                        }
                        else if (instrument == Instrument.Drums)
                        {
                            chart.PartDrums.SoloSections.Add(note);
                        }
                        ret = true;
                    }
                }
            }

            return(ret);
        }