Challenge processing fixes.
This commit is contained in:
parent
cb34b3b9b6
commit
11d5ed635f
|
@ -167,7 +167,7 @@ static void drawChallenges(void)
|
||||||
|
|
||||||
for (i = 0 ; i < MAX_CHALLENGES ; i++)
|
for (i = 0 ; i < MAX_CHALLENGES ; i++)
|
||||||
{
|
{
|
||||||
c = mission->challengeData.challenges[i];
|
c = game.currentMission->challengeData.challenges[i];
|
||||||
|
|
||||||
y += 50;
|
y += 50;
|
||||||
|
|
||||||
|
|
|
@ -327,7 +327,7 @@ static void drawChallenges(void)
|
||||||
r.y -= 50;
|
r.y -= 50;
|
||||||
c = game.currentMission->challengeData.challenges[0];
|
c = game.currentMission->challengeData.challenges[0];
|
||||||
drawText((SCREEN_WIDTH / 2) - 25, SCREEN_HEIGHT - r.y, 18, TA_RIGHT, colors.white, _("Craft: %s"), game.currentMission->craft);
|
drawText((SCREEN_WIDTH / 2) - 25, SCREEN_HEIGHT - r.y, 18, TA_RIGHT, colors.white, _("Craft: %s"), game.currentMission->craft);
|
||||||
drawText((SCREEN_WIDTH / 2) + 25, SCREEN_HEIGHT - r.y, 18, TA_LEFT, c ? colors.green : colors.white, "1. %s", getChallengeDescription(c));
|
drawText((SCREEN_WIDTH / 2) + 25, SCREEN_HEIGHT - r.y, 18, TA_LEFT, (c->passed) ? colors.green : colors.white, "1. %s", getChallengeDescription(c));
|
||||||
|
|
||||||
r.y -= 30;
|
r.y -= 30;
|
||||||
drawText((SCREEN_WIDTH / 2) - 25, SCREEN_HEIGHT - r.y, 18, TA_RIGHT, colors.white, _("Time Limit: %s"), timeLimit);
|
drawText((SCREEN_WIDTH / 2) - 25, SCREEN_HEIGHT - r.y, 18, TA_RIGHT, colors.white, _("Time Limit: %s"), timeLimit);
|
||||||
|
@ -344,7 +344,7 @@ static void drawChallenges(void)
|
||||||
c = game.currentMission->challengeData.challenges[2];
|
c = game.currentMission->challengeData.challenges[2];
|
||||||
if (c)
|
if (c)
|
||||||
{
|
{
|
||||||
drawText((SCREEN_WIDTH / 2) + 25, SCREEN_HEIGHT - r.y, 18, TA_LEFT, (c) ? colors.green : colors.white, "3. %s", getChallengeDescription(c));
|
drawText((SCREEN_WIDTH / 2) + 25, SCREEN_HEIGHT - r.y, 18, TA_LEFT, (c->passed) ? colors.green : colors.white, "3. %s", getChallengeDescription(c));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,7 @@ static void updateChallenges(void)
|
||||||
|
|
||||||
for (i = 0 ; i < MAX_CHALLENGES ; i++)
|
for (i = 0 ; i < MAX_CHALLENGES ; i++)
|
||||||
{
|
{
|
||||||
c = mission->challengeData.challenges[i];
|
c = game.currentMission->challengeData.challenges[i];
|
||||||
|
|
||||||
if (!c->passed)
|
if (!c->passed)
|
||||||
{
|
{
|
||||||
|
@ -159,6 +159,8 @@ static void printStats(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printf("DEBUG: Accuracy=%d\n", getPercent(battle.stats[STAT_SHOTS_FIRED], battle.stats[STAT_SHOTS_HIT]));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void updateTimeChallenge(Challenge *c)
|
static void updateTimeChallenge(Challenge *c)
|
||||||
|
@ -281,13 +283,16 @@ void updateChallengeMissions(void)
|
||||||
|
|
||||||
for (i = 0 ; i < MAX_CHALLENGES ; i++)
|
for (i = 0 ; i < MAX_CHALLENGES ; i++)
|
||||||
{
|
{
|
||||||
c = mission->challengeData.challenges[i];
|
c = m->challengeData.challenges[i];
|
||||||
|
|
||||||
m->totalChallenges++;
|
if (c)
|
||||||
|
|
||||||
if (c->passed)
|
|
||||||
{
|
{
|
||||||
m->completedChallenges++;
|
m->totalChallenges++;
|
||||||
|
|
||||||
|
if (c->passed)
|
||||||
|
{
|
||||||
|
m->completedChallenges++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ extern char *getTranslatedString(char *string);
|
||||||
extern char *getFileLocation(char *filename);
|
extern char *getFileLocation(char *filename);
|
||||||
extern char *getLookupName(char *prefix, long num);
|
extern char *getLookupName(char *prefix, long num);
|
||||||
extern char *timeToString(long millis, int showHours);
|
extern char *timeToString(long millis, int showHours);
|
||||||
|
extern int getPercent(float current, float total);
|
||||||
|
|
||||||
extern Dev dev;
|
extern Dev dev;
|
||||||
extern Battle battle;
|
extern Battle battle;
|
||||||
|
|
|
@ -114,12 +114,15 @@ static void saveChallenges(cJSON *gameJSON)
|
||||||
{
|
{
|
||||||
c = mission->challengeData.challenges[i];
|
c = mission->challengeData.challenges[i];
|
||||||
|
|
||||||
challengeJSON = cJSON_CreateObject();
|
if (c)
|
||||||
cJSON_AddStringToObject(challengeJSON, "type", getLookupName("CHALLENGE_", c->type));
|
{
|
||||||
cJSON_AddNumberToObject(challengeJSON, "value", c->value);
|
challengeJSON = cJSON_CreateObject();
|
||||||
cJSON_AddNumberToObject(challengeJSON, "passed", c->passed);
|
cJSON_AddStringToObject(challengeJSON, "type", getLookupName("CHALLENGE_", c->type));
|
||||||
|
cJSON_AddNumberToObject(challengeJSON, "value", c->value);
|
||||||
|
cJSON_AddNumberToObject(challengeJSON, "passed", c->passed);
|
||||||
|
|
||||||
cJSON_AddItemToArray(challengesJSON, challengeJSON);
|
cJSON_AddItemToArray(challengesJSON, challengeJSON);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cJSON_AddItemToObject(missionJSON, "challenges", challengesJSON);
|
cJSON_AddItemToObject(missionJSON, "challenges", challengesJSON);
|
||||||
|
|
Loading…
Reference in New Issue