They are still stored as floats in save file to be backward compatible
}
text->glPrintOutlined(1, 0, 0, 1 - bonustime, 1024 / 2 - 10 * strlen(bonus_name), 768 / 16 + 768 * 4 / 5, bonus_name, 1, 2, 1024, 768);
}
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);
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);
if (Tutorial::active) {
bonusvalue = 0;
}
if (Tutorial::active) {
bonusvalue = 0;
}
- bonusvalue /= bonusnum[bonus];
+ if (bonusvalue > 0) {
+ bonusvalue /= bonusnum[bonus];
+ if (bonusvalue <= 0) {
+ bonusvalue = 0;
+ }
+ }
bonustotal += bonusvalue;
}
bonustime += multiplier;
bonustotal += bonusvalue;
}
bonustime += multiplier;
#include "Objects/Person.hpp"
int bonus;
#include "Objects/Person.hpp"
int bonus;
-float bonusvalue;
-float bonustotal;
-float startbonustotal;
+int bonusvalue;
+int bonustotal;
+int startbonustotal;
float bonustime;
float bonusnum[100];
float bonustime;
float bonusnum[100];
extern const char *bonus_names[bonus_count];
extern int bonus;
extern const char *bonus_names[bonus_count];
extern int bonus;
-extern float bonusvalue;
-extern float bonustotal;
+extern int bonusvalue;
+extern int bonustotal;
-extern float startbonustotal;
+extern int startbonustotal;
extern float bonusnum[100];
extern void award_bonus(int playerid, int bonusid, int alt_value = 0);
extern float bonusnum[100];
extern void award_bonus(int playerid, int bonusid, int alt_value = 0);
funpackf(tfile, "Bb", &c);
campaignName.append(1, c);
}
funpackf(tfile, "Bb", &c);
campaignName.append(1, c);
}
+ float fscore, fhighscore;
funpackf(tfile, "Bf", &(campaignProgress[campaignName].time));
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].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++) {
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", &points);
for (int i = 0; i < 50; i++) {
- funpackf(tfile, "Bf", &(highscore[i]));
+ float fscore;
+ funpackf(tfile, "Bf", &(fscore));
funpackf(tfile, "Bf", &(fasttime[i]));
funpackf(tfile, "Bf", &(fasttime[i]));
}
for (int i = 0; i < 60; i++) {
funpackf(tfile, "Bb", &(unlocked[i]));
}
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, "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.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, "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", 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++) {
fpackf(tfile, "Bf", fasttime[j]);
}
for (unsigned j = 0; j < 60; j++) {
campaignProgress[currentCampaign].time = 0;
}
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;
}
{
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]) {
{
if (!devtools) {
if (score > highscore[level]) {
#include <vector>
struct CampaignProgress {
#include <vector>
struct CampaignProgress {
float time;
std::vector<int> choices;
CampaignProgress() {
float time;
std::vector<int> choices;
CampaignProgress() {
Account(FILE* tfile);
void endGame();
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();
// getter and setters
int getDifficulty();
const std::string& getName() {
return name;
};
const std::string& getName() {
return name;
};
- float getCampaignScore() {
+ int getCampaignScore() {
return campaignProgress[currentCampaign].score;
};
int getCampaignChoicesMade() {
return campaignProgress[currentCampaign].score;
};
int getCampaignChoicesMade() {
};
void setCampaignScore(int s) {
campaignProgress[currentCampaign].score = s;
};
void setCampaignScore(int s) {
campaignProgress[currentCampaign].score = s;
- if (s > campaignProgress[currentCampaign].highscore)
+ if (s > campaignProgress[currentCampaign].highscore) {
campaignProgress[currentCampaign].highscore = s;
campaignProgress[currentCampaign].highscore = s;
};
void setCampaignFinalTime(float t) {
campaignProgress[currentCampaign].time = t;
};
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;
campaignProgress[currentCampaign].fasttime = t;
};
float getCampaignFasttime() {
return campaignProgress[currentCampaign].fasttime;
};
float getCampaignFasttime() {
return campaignProgress[currentCampaign].fasttime;
void resetFasttime() {
campaignProgress[currentCampaign].fasttime = 0;
};
void resetFasttime() {
campaignProgress[currentCampaign].fasttime = 0;
};
- float getCampaignHighScore() {
+ int getCampaignHighScore() {
return campaignProgress[currentCampaign].highscore;
};
return campaignProgress[currentCampaign].highscore;
};
- float getHighScore(int i) {
+ int getHighScore(int i) {
return highscore[i];
};
float getFastTime(int i) {
return highscore[i];
};
float getFastTime(int i) {
int difficulty;
int progress; // progress in challenge levels
float points;
int difficulty;
int progress; // progress in challenge levels
float points;
float fasttime[50];
bool unlocked[60];
std::string name;
float fasttime[50];
bool unlocked[60];
std::string name;