Esempio n. 1
0
        public static bool UpdateGameLogic(CKeys keys, CMouse mouse)
        {
            bool run = true;

            _Cursor.Visible = mouse.Visible;

            mouse.CopyEvents();
            keys.CopyEvents();

            CVideo.Update();
            CSound.Update();
            CBackgroundMusic.Update();
            CController.Update();
            CProfiles.Update();

            if (CSettings.ProgramState != EProgramState.EditTheme)
            {
                run &= _HandleInputs(keys, mouse);
                run &= _Update();
                CParty.UpdateGame();
            }
            else
            {
                run &= _HandleInputThemeEditor(keys, mouse);
                run &= _Update();
            }

            return(run);
        }
Esempio n. 2
0
 public void AddProfileChangedCallback(ProfileChangedCallback notification)
 {
     CProfiles.AddProfileChangedCallback(notification);
 }
Esempio n. 3
0
 public bool IsGuest(Guid profileID)
 {
     return(CProfiles.IsGuestProfile(profileID));
 }
Esempio n. 4
0
 public bool IsProfileIDValid(Guid profileID)
 {
     return(CProfiles.IsProfileIDValid(profileID));
 }
Esempio n. 5
0
 public CAvatar GetAvatarByFilename(string fileName)
 {
     return(CProfiles.GetAvatarByFilename(fileName));
 }
Esempio n. 6
0
 public CTextureRef GetAvatar(Guid profileID)
 {
     return(CProfiles.GetAvatarTextureFromProfile(profileID));
 }
Esempio n. 7
0
 public string GetPlayerName(Guid profileID, int playerNum = 0)
 {
     return(CProfiles.GetPlayerName(profileID, playerNum));
 }
Esempio n. 8
0
 public EGameDifficulty GetDifficulty(Guid profileID)
 {
     return(CProfiles.GetDifficulty(profileID));
 }
Esempio n. 9
0
 public CProfile[] GetProfiles()
 {
     return(CProfiles.GetProfiles());
 }
Esempio n. 10
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;
        }