示例#1
0
        private static void _DrawDebugInfos()
        {
            if (CConfig.Config.Debug.DebugLevel == EDebugLevel.TR_CONFIG_OFF)
            {
                return;
            }

            List <String> debugOutput = new List <string> {
                CTime.GetFPS().ToString("FPS: 000")
            };

            if (CConfig.Config.Debug.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL1)
            {
                debugOutput.Add(CSound.GetStreamCount().ToString(CLanguage.Translate("TR_DEBUG_AUDIO_STREAMS") + ": 00"));
                debugOutput.Add(CVideo.GetNumStreams().ToString(CLanguage.Translate("TR_DEBUG_VIDEO_STREAMS") + ": 00"));
                debugOutput.Add(CDraw.TextureCount().ToString(CLanguage.Translate("TR_DEBUG_TEXTURES") + ": 00000"));
                long memory = GC.GetTotalMemory(false);
                debugOutput.Add((memory / 1000000L).ToString(CLanguage.Translate("TR_DEBUG_MEMORY") + ": 00000 MB"));

                if (CConfig.Config.Debug.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL2)
                {
                    debugOutput.Add(CRecord.GetToneAbs(0).ToString(CLanguage.Translate("TR_DEBUG_TONE_ABS") + " P1: 00"));
                    debugOutput.Add(CRecord.GetMaxVolume(0).ToString(CLanguage.Translate("TR_DEBUG_MAX_VOLUME") + " P1: 0.000"));
                    debugOutput.Add(CRecord.GetToneAbs(1).ToString(CLanguage.Translate("TR_DEBUG_TONE_ABS") + " P2: 00"));
                    debugOutput.Add(CRecord.GetMaxVolume(1).ToString(CLanguage.Translate("TR_DEBUG_MAX_VOLUME") + " P2: 0.000"));

                    if (CConfig.Config.Debug.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL3)
                    {
                        debugOutput.Add(CSongs.NumSongsWithCoverLoaded.ToString(CLanguage.Translate("TR_DEBUG_SONGS") + ": 00000"));

                        if (CConfig.Config.Debug.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL_MAX)
                        {
                            debugOutput.Add(_Cursor.X.ToString(CLanguage.Translate("TR_DEBUG_MOUSE") + " : (0000/") + _Cursor.Y.ToString("0000)"));
                        }
                    }
                }
            }
            CFont   font = new CFont("Normal", EStyle.Normal, 25);
            SColorF gray = new SColorF(1f, 1f, 1f, 0.5f);
            float   y    = 0;

            foreach (string txt in debugOutput)
            {
                float      textWidth = CFonts.GetTextWidth(txt, font);
                RectangleF rect      = new RectangleF(CSettings.RenderW - textWidth, y, textWidth, CFonts.GetTextHeight(txt, font));
                CDraw.DrawRect(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear));
                CFonts.DrawText(txt, font, rect.X, rect.Y, CSettings.ZNear);
                y += rect.Height;
            }
        }
示例#2
0
文件: CMain.cs 项目: da-ka/Vocaluxe
 public bool ToneValid(int player)
 {
     return(CRecord.ToneValid(player));
 }
示例#3
0
文件: CMain.cs 项目: da-ka/Vocaluxe
 public int GetToneAbs(int player)
 {
     return(CRecord.GetToneAbs(player));
 }
示例#4
0
        public static void UpdatePoints(float time)
        {
            CSong song = _SongQueue.GetSong();

            if (song == null)
            {
                return;
            }

            float b = GetBeatFromTime(time, song.BPM, song.Gap);

            if (b <= CurrentBeatF)
            {
                return;
            }

            CurrentBeatF = b;

            MidRecordedBeat = -0.5f + GetBeatFromTime(time, song.BPM, song.Gap + CConfig.Config.Record.MicDelay / 1000f);

            for (int p = 0; p < _NumPlayers; p++)
            {
                CRecord.AnalyzeBuffer(p);
            }

            if (_LastEvalBeat >= RecordedBeat)
            {
                return;
            }

            for (int p = 0; p < _NumPlayers; p++)
            {
                for (int beat = _LastEvalBeat + 1; beat <= RecordedBeat; beat++)
                {
                    if ((_SongQueue.GetCurrentGameMode() == EGameMode.TR_GAMEMODE_MEDLEY && song.Medley.EndBeat == beat) ||
                        (_SongQueue.GetCurrentGameMode() == EGameMode.TR_GAMEMODE_SHORTSONG && song.ShortEnd.EndBeat == beat))
                    {
                        Players[p].SongFinished = true;
                    }

                    CSongLine[] lines = song.Notes.GetVoice(Players[p].VoiceNr).Lines;
                    int         line  = song.Notes.GetVoice(Players[p].VoiceNr).FindPreviousLine(beat);
                    if (line < 0 || lines[line].EndBeat < beat)
                    {
                        continue;
                    }

                    //Check for already sung
                    if (line < Players[p].SungLines.Count - 1)
                    {
                        continue; // Already sung whole line
                    }
                    if (line == Players[p].SungLines.Count - 1)
                    {
                        //We are in the last line
                        if (beat <= Players[p].SungLines[line].LastNoteBeat)
                        {
                            continue; //We already have something that ends with/after that beat
                        }
                    }

                    if (line != Players[p].CurrentLine)
                    {
                        Players[p].CurrentNote = -1;
                    }

                    Players[p].CurrentLine = line;

                    while (Players[p].SungLines.Count <= line)
                    {
                        Players[p].SungLines.Add(new CSungLine());
                    }

                    CSongNote[] notes = lines[line].Notes;
                    int         note  = lines[line].FindPreviousNote(beat);
                    if (note < 0 || notes[note].EndBeat < beat)
                    {
                        continue;
                    }

                    Players[p].CurrentNote = note;

                    if (line == lines.Length - 1 && beat == lines[line].LastNoteBeat)
                    {
                        Players[p].SongFinished = true;
                    }

                    if (notes[note].PointsForBeat > 0 && (CRecord.ToneValid(p)
#if DEBUG_HIT
                                                          || true
#endif
                                                          ))
                    {
                        int tone       = notes[note].Tone;
                        int tonePlayer = CRecord.GetTone(p);

                        while (tonePlayer - tone > 6)
                        {
                            tonePlayer -= 12;
                        }

                        while (tonePlayer - tone < -6)
                        {
                            tonePlayer += 12;
                        }

#if DEBUG_HIT
                        tonePlayer = tone;
#endif

                        Players[p].NoteDiff = Math.Abs(tone - tonePlayer);
                        bool hit = Players[p].NoteDiff <= (2 - (int)CProfiles.GetDifficulty(Players[p].ProfileID));

                        if (hit)
                        {
                            // valid
                            //CRecord.RecordSetTone(p, Tone);
                            double points = (CSettings.MaxScore - CSettings.LinebonusScore) * (double)notes[note].PointsForBeat /
                                            song.Notes.GetVoice(Players[p].VoiceNr).Points;
                            if (notes[note].Type == ENoteType.Golden)
                            {
                                Players[p].PointsGoldenNotes += points;
                            }

                            Players[p].Points += points;

                            // update player notes (sung notes)
                            if (Players[p].SungLines[line].NoteCount > 0)
                            {
                                CSungNote lastNote = Players[p].SungLines[line].LastNote;

                                if (notes[note].StartBeat == beat || lastNote.EndBeat + 1 != beat || lastNote.Tone != tone || !lastNote.Hit)
                                {
                                    Players[p].SungLines[line].AddNote(new CSungNote(beat, 1, tone, notes[note], points));
                                }
                                else
                                {
                                    Players[p].SungLines[line].IncLastNoteLength();
                                    Players[p].SungLines[line].LastNote.Points += points;
                                }
                            }
                            else
                            {
                                Players[p].SungLines[line].AddNote(new CSungNote(beat, 1, tone, notes[note], points));
                            }

                            Players[p].SungLines[line].LastNote.CheckPerfect();
                            Players[p].SungLines[line].IsPerfect(lines[line]);
                        }
                        else
                        {
                            if (Players[p].SungLines[line].NoteCount > 0)
                            {
                                CSungNote lastNote = Players[p].SungLines[line].LastNote;
                                if (lastNote.Tone != tonePlayer || lastNote.EndBeat + 1 != beat || lastNote.Hit)
                                {
                                    Players[p].SungLines[line].AddNote(new CSungNote(beat, 1, tonePlayer));
                                }
                                else
                                {
                                    Players[p].SungLines[line].IncLastNoteLength();
                                }
                            }
                            else
                            {
                                Players[p].SungLines[line].AddNote(new CSungNote(beat, 1, tonePlayer));
                            }
                        }
                    }

                    // Line Bonus
                    int numLinesWithPoints = song.Notes.GetNumLinesWithPoints(Players[p].VoiceNr);
                    if (beat == lines[line].LastNoteBeat && lines[line].Points > 0 && numLinesWithPoints > 0)
                    {
                        double factor = Players[p].SungLines[line].Points / (double)lines[line].Points;
                        if (factor <= 0.4)
                        {
                            factor = 0.0;
                        }
                        else if (factor >= 0.9)
                        {
                            factor = 1.0;
                        }
                        else
                        {
                            factor -= 0.4;
                            factor *= 2;
                            factor *= factor;
                        }

                        double points = CSettings.LinebonusScore * factor / numLinesWithPoints;
                        Players[p].Points                      += points;
                        Players[p].PointsLineBonus             += points;
                        Players[p].SungLines[line].BonusPoints += points;
                    }
                }
            }
            _LastEvalBeat = RecordedBeat;
        }