}
text->glPrintOutlined(1, 0, 0, 1 - bonustime, 1024 / 2 - 10 * strlen(bonus_name), 768 / 16 + 768 * 4 / 5, bonus_name, 1, 2, 1024, 768);
- string = to_string((int)bonusvalue);
+ string = to_string(bonusvalue);
text->glPrintOutlined(1, 0, 0, 1 - bonustime, 1024 / 2 - 10 * string.size(), 768 / 16 - 20 + 768 * 4 / 5, string, 1, 2 * .8, 1024, 768);
glColor4f(.5, .5, .5, 1);
funpackf(tfile, "Bb", &c);
campaignName.append(1, c);
}
+ float fscore, fhighscore;
funpackf(tfile, "Bf", &(campaignProgress[campaignName].time));
- funpackf(tfile, "Bf", &(campaignProgress[campaignName].score));
+ funpackf(tfile, "Bf", &(fscore));
funpackf(tfile, "Bf", &(campaignProgress[campaignName].fasttime));
- funpackf(tfile, "Bf", &(campaignProgress[campaignName].highscore));
+ funpackf(tfile, "Bf", &(fhighscore));
+ campaignProgress[campaignName].score = fscore;
+ campaignProgress[campaignName].highscore = fhighscore;
int campaignchoicesmade, campaignchoice;
funpackf(tfile, "Bi", &campaignchoicesmade);
for (int j = 0; j < campaignchoicesmade; j++) {
funpackf(tfile, "Bf", &points);
for (int i = 0; i < 50; i++) {
- funpackf(tfile, "Bf", &(highscore[i]));
+ float fscore;
+ funpackf(tfile, "Bf", &(fscore));
funpackf(tfile, "Bf", &(fasttime[i]));
+ highscore[i] = fscore;
}
for (int i = 0; i < 60; i++) {
funpackf(tfile, "Bb", &(unlocked[i]));
fpackf(tfile, "Bb", it->first[j]);
}
fpackf(tfile, "Bf", it->second.time);
- fpackf(tfile, "Bf", it->second.score);
+ fpackf(tfile, "Bf", float(it->second.score));
fpackf(tfile, "Bf", it->second.fasttime);
- fpackf(tfile, "Bf", it->second.highscore);
+ fpackf(tfile, "Bf", float(it->second.highscore));
fpackf(tfile, "Bi", it->second.choices.size());
for (unsigned j = 0; j < it->second.choices.size(); j++) {
fpackf(tfile, "Bi", it->second.choices[j]);
fpackf(tfile, "Bf", points);
for (unsigned j = 0; j < 50; j++) {
- fpackf(tfile, "Bf", highscore[j]);
+ fpackf(tfile, "Bf", float(highscore[j]));
fpackf(tfile, "Bf", fasttime[j]);
}
for (unsigned j = 0; j < 60; j++) {
campaignProgress[currentCampaign].time = 0;
}
-void Account::winCampaignLevel(int choice, float score, float time)
+void Account::winCampaignLevel(int choice, int score, float time)
{
campaignProgress[currentCampaign].choices.push_back(choice);
setCampaignScore(campaignProgress[currentCampaign].score + score);
campaignProgress[currentCampaign].time = time;
}
-void Account::winLevel(int level, float score, float time)
+void Account::winLevel(int level, int score, float time)
{
if (!devtools) {
if (score > highscore[level]) {
#include <vector>
struct CampaignProgress {
- float highscore;
+ int highscore;
float fasttime;
- float score;
+ int score;
float time;
std::vector<int> choices;
CampaignProgress() {
Account(FILE* tfile);
void endGame();
- void winCampaignLevel(int choice, float score, float time);
- void winLevel(int level, float score, float time);
+ void winCampaignLevel(int choice, int score, float time);
+ void winLevel(int level, int score, float time);
// getter and setters
int getDifficulty();
const std::string& getName() {
return name;
};
- float getCampaignScore() {
+ int getCampaignScore() {
return campaignProgress[currentCampaign].score;
};
int getCampaignChoicesMade() {
};
void setCampaignScore(int s) {
campaignProgress[currentCampaign].score = s;
- if (s > campaignProgress[currentCampaign].highscore)
+ if (s > campaignProgress[currentCampaign].highscore) {
campaignProgress[currentCampaign].highscore = s;
+ }
};
void setCampaignFinalTime(float t) {
campaignProgress[currentCampaign].time = t;
- if ((t < campaignProgress[currentCampaign].fasttime) || ((campaignProgress[currentCampaign].fasttime == 0) && (t != 0)))
+ if ((t < campaignProgress[currentCampaign].fasttime) || ((campaignProgress[currentCampaign].fasttime == 0) && (t != 0))) {
campaignProgress[currentCampaign].fasttime = t;
+ }
};
float getCampaignFasttime() {
return campaignProgress[currentCampaign].fasttime;
void resetFasttime() {
campaignProgress[currentCampaign].fasttime = 0;
};
- float getCampaignHighScore() {
+ int getCampaignHighScore() {
return campaignProgress[currentCampaign].highscore;
};
- float getHighScore(int i) {
+ int getHighScore(int i) {
return highscore[i];
};
float getFastTime(int i) {
int difficulty;
int progress; // progress in challenge levels
float points;
- float highscore[50];
+ int highscore[50];
float fasttime[50];
bool unlocked[60];
std::string name;