ScreenChooseGame::ScreenChooseGame() { bChooseGame = Button(2.0f, METHOD_CALLBACK(ScreenChooseGame, clickButtonChooseGame), "choose", KEY_ENTER); addItem(&bChooseGame); hsHighScore = HighScore(3.0f); addItem(&hsHighScore); }
/* This function needs much more error handling */ void highscore::Load(const festring& File) { { inputfile HighScore(File, 0, false); if(!HighScore.IsOpen()) return; HighScore.Get(); if(HighScore.Eof()) return; } inputfile HighScore(File, 0, false); HighScore >> Version; HighScore >> Score >> Entry >> Time >> RandomID >> LastAdd; }
truth DebugDraw(festring Filename) { { inputfile HighScore(Filename, 0, false); if(!HighScore.IsOpen()) return false; HighScore.Get(); if(HighScore.Eof()) return false; } inputfile HighScore(Filename, 0, false); ushort HVersion; HighScore >> HVersion; std::cout << "\nFile is version " << HVersion << std::endl; return true; }
void highscore::Save(const festring& File) const { outputfile HighScore(File); long CheckSum = HIGH_SCORE_VERSION + LastAdd; for(ushort c = 0; c < Score.size(); ++c) { CheckSum += Score[c] + Entry[c].GetCheckSum() + RandomID[c]; } HighScore << ushort(HIGH_SCORE_VERSION) << Score << Entry << Time << RandomID << LastAdd << CheckSum; }
const HighScore& HighScoreList::GetTopScore() const { if( vHighScores.empty() ) { static HighScore hs; hs = HighScore(); return hs; } else { return vHighScores[0]; } }
void PlayerStageStats::InternalInit() { m_pStyle= NULL; m_for_multiplayer= false; m_player_number= PLAYER_1; m_multiplayer_number= MultiPlayer_P1; m_bPlayerCanAchieveFullCombo = true; m_bJoined = false; m_vpPossibleSteps.clear(); m_iStepsPlayed = 0; m_fAliveSeconds = 0; m_bFailed = false; m_iPossibleDancePoints = 0; m_iCurPossibleDancePoints = 0; m_iActualDancePoints = 0; m_iPossibleGradePoints = 0; m_iCurCombo = 0; m_iMaxCombo = 0; m_iCurMissCombo = 0; m_iCurScoreMultiplier = 1; m_iScore = 0; m_iMaxScore = 0; m_iCurMaxScore = 0; m_iSongsPassed = 0; m_iSongsPlayed = 0; m_fLifeRemainingSeconds = 0; m_iNumControllerSteps = 0; m_fCaloriesBurned = 0; ZERO( m_iTapNoteScores ); ZERO( m_iHoldNoteScores ); m_radarPossible.Zero(); m_radarActual.Zero(); m_fFirstSecond = FLT_MAX; m_fLastSecond = 0; m_StageAward = StageAward_Invalid; m_PeakComboAward = PeakComboAward_Invalid; m_iPersonalHighScoreIndex = -1; m_iMachineHighScoreIndex = -1; m_bDisqualified = false; m_rc = RankingCategory_Invalid; m_HighScore = HighScore(); }
HighScore HighScore::fromJSON(JSON json) { return HighScore(json.getInt("score")); }
void Kolf::gameOver() { int curPar = 0; int lowScore = INT_MAX; // let's hope it doesn't stay this way! int curScore = 1; // names of people who had the lowest score QStringList names; HighScoreList highScores; int scoreBoardIndex = 1; while (curScore != 0) { QString curName; // name taken as a reference and filled out curScore = scoreboard->total(scoreBoardIndex, curName); scoreBoardIndex++; if (curName == i18n("Par")) { curPar = curScore; continue; } if (curScore == 0) continue; // attempt to add everybody to the highscore list // (ignored if we aren't competing down below) highScores.append(HighScore(curName, curScore)); if (curScore < lowScore) { names.clear(); lowScore = curScore; names.append(curName); } else if (curScore == lowScore) names.append(curName); } // only announce a winner if more than two entries // (player and par) are on the scoreboard + one to go past end // + 1 for koodoo if (scoreBoardIndex > 4) { if (names.count() > 1) { QString winners = names.join(i18n(" and ")); KMessageBox::information(this, i18n("%1 tied").arg(winners)); } else KMessageBox::information(this, i18n("%1 won!").arg(names.first())); } if (competition) { // deal with highscores // KScoreDialog makes it very easy :-)) KScoreDialog *scoreDialog = new KScoreDialog(KScoreDialog::Name | KScoreDialog::Custom1 | KScoreDialog::Score, this); scoreDialog->addField(KScoreDialog::Custom1, i18n("Par"), "Par"); CourseInfo courseInfo; game->courseInfo(courseInfo, game->curFilename()); scoreDialog->setConfigGroup(courseInfo.untranslatedName + QString(" Highscores")); for (HighScoreList::Iterator it = highScores.begin(); it != highScores.end(); ++it) { KScoreDialog::FieldInfo info; info[KScoreDialog::Name] = (*it).name; info[KScoreDialog::Custom1] = QString::number(curPar); scoreDialog->addScore((*it).score, info, false, true); } scoreDialog->setComment(i18n("High Scores for %1").arg(courseInfo.name)); scoreDialog->show(); } QTimer::singleShot(700, this, SLOT(closeGame())); }