Game plus tweaks.
This commit is contained in:
parent
cdc69cc6a5
commit
60d8020c4e
|
@ -470,6 +470,8 @@ typedef struct {
|
||||||
int spawnInterval;
|
int spawnInterval;
|
||||||
int numToSpawn;
|
int numToSpawn;
|
||||||
int saveDelay;
|
int saveDelay;
|
||||||
|
unsigned long time;
|
||||||
|
int numObjectives;
|
||||||
Bob *bob;
|
Bob *bob;
|
||||||
Boss *boss;
|
Boss *boss;
|
||||||
Entity *entityToTrack;
|
Entity *entityToTrack;
|
||||||
|
|
|
@ -256,7 +256,7 @@ static void drawBossHealth(void)
|
||||||
void drawMissionStatus(void)
|
void drawMissionStatus(void)
|
||||||
{
|
{
|
||||||
Objective *o;
|
Objective *o;
|
||||||
int y, x, w, h, size, mid, i;
|
int y, x, w, h, size, mid, i, textSize, lineSpacing;
|
||||||
float rw, rh, d;
|
float rw, rh, d;
|
||||||
SDL_Color c;
|
SDL_Color c;
|
||||||
SDL_Rect *r;
|
SDL_Rect *r;
|
||||||
|
@ -274,6 +274,14 @@ void drawMissionStatus(void)
|
||||||
drawText(SCREEN_WIDTH / 2, 100, 40, TA_CENTER, colors.white, app.strings[ST_OBJECTIVES]);
|
drawText(SCREEN_WIDTH / 2, 100, 40, TA_CENTER, colors.white, app.strings[ST_OBJECTIVES]);
|
||||||
|
|
||||||
y = 180;
|
y = 180;
|
||||||
|
textSize = 24;
|
||||||
|
lineSpacing = 55;
|
||||||
|
|
||||||
|
if (world.numObjectives > 5)
|
||||||
|
{
|
||||||
|
textSize -= (world.numObjectives - 5) * 2;
|
||||||
|
lineSpacing -= (world.numObjectives - 5) * 8;
|
||||||
|
}
|
||||||
|
|
||||||
for (o = world.objectiveHead.next ; o != NULL ; o = o->next)
|
for (o = world.objectiveHead.next ; o != NULL ; o = o->next)
|
||||||
{
|
{
|
||||||
|
@ -286,11 +294,11 @@ void drawMissionStatus(void)
|
||||||
status = app.strings[ST_COMPLETE];
|
status = app.strings[ST_COMPLETE];
|
||||||
}
|
}
|
||||||
|
|
||||||
drawText(x + 20, y, 24, TA_LEFT, c, o->description);
|
drawText(x + 20, y, textSize, TA_LEFT, c, o->description);
|
||||||
drawText(SCREEN_WIDTH / 2 + 100, y, 24, TA_LEFT, c, "%d / %d", MIN(o->currentValue, o->targetValue), o->targetValue);
|
drawText(SCREEN_WIDTH / 2 + 100, y, textSize, TA_LEFT, c, "%d / %d", MIN(o->currentValue, o->targetValue), o->targetValue);
|
||||||
drawText(x + w - 20, y, 24, TA_RIGHT, c, status);
|
drawText(x + w - 20, y, textSize, TA_RIGHT, c, status);
|
||||||
|
|
||||||
y += 55;
|
y += lineSpacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
size = 60;
|
size = 60;
|
||||||
|
|
|
@ -55,7 +55,7 @@ void initObjectives(void)
|
||||||
if (world.isReturnVisit || game.plus != PLUS_NONE)
|
if (world.isReturnVisit || game.plus != PLUS_NONE)
|
||||||
{
|
{
|
||||||
o->targetValue = o->totalValue;
|
o->targetValue = o->totalValue;
|
||||||
o->required = 0;
|
o->required = game.plus != PLUS_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((strcmp(o->targetName, "ENEMY") == 0 && o->targetValue == o->totalValue) || game.plus != PLUS_PLUS_PLUS)
|
if ((strcmp(o->targetName, "ENEMY") == 0 && o->targetValue == o->totalValue) || game.plus != PLUS_PLUS_PLUS)
|
||||||
|
|
|
@ -340,6 +340,8 @@ static void doWorldInProgress(void)
|
||||||
|
|
||||||
doLocationTriggers();
|
doLocationTriggers();
|
||||||
|
|
||||||
|
world.time++;
|
||||||
|
|
||||||
if (world.allObjectivesComplete && world.state != WS_COMPLETE)
|
if (world.allObjectivesComplete && world.state != WS_COMPLETE)
|
||||||
{
|
{
|
||||||
world.bob->flags |= EF_IMMUNE;
|
world.bob->flags |= EF_IMMUNE;
|
||||||
|
|
|
@ -29,7 +29,7 @@ static void loadObjectives(cJSON *root);
|
||||||
void loadWorld(char *id)
|
void loadWorld(char *id)
|
||||||
{
|
{
|
||||||
cJSON *root;
|
cJSON *root;
|
||||||
char *text, *filename;
|
char *text, *filename, enemyTypes[MAX_DESCRIPTION_LENGTH];
|
||||||
|
|
||||||
memset(&world, 0, sizeof(World));
|
memset(&world, 0, sizeof(World));
|
||||||
|
|
||||||
|
@ -72,7 +72,8 @@ void loadWorld(char *id)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
loadEnemyTypes("Pistol|Grenade|MachineGun|Shotgun|Laser|SpreadGun|Plasma");
|
STRNCPY(enemyTypes, "Pistol|Grenade|MachineGun|Shotgun|Laser|SpreadGun|Plasma", MAX_DESCRIPTION_LENGTH);
|
||||||
|
loadEnemyTypes(enemyTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadTriggers(cJSON_GetObjectItem(root, "triggers"));
|
loadTriggers(cJSON_GetObjectItem(root, "triggers"));
|
||||||
|
@ -196,6 +197,9 @@ static void loadObjectives(cJSON *root)
|
||||||
{
|
{
|
||||||
Objective *o;
|
Objective *o;
|
||||||
cJSON *node;
|
cJSON *node;
|
||||||
|
int hasEliminateAll;
|
||||||
|
|
||||||
|
hasEliminateAll = 0;
|
||||||
|
|
||||||
for (node = root->child ; node != NULL ; node = node->next)
|
for (node = root->child ; node != NULL ; node = node->next)
|
||||||
{
|
{
|
||||||
|
@ -212,13 +216,20 @@ static void loadObjectives(cJSON *root)
|
||||||
o->currentValue = cJSON_GetObjectItem(node, "currentValue")->valueint;
|
o->currentValue = cJSON_GetObjectItem(node, "currentValue")->valueint;
|
||||||
o->required = cJSON_GetObjectItem(node, "required")->valueint;
|
o->required = cJSON_GetObjectItem(node, "required")->valueint;
|
||||||
|
|
||||||
|
if (strcmp(o->targetName, "ENEMY") == 0)
|
||||||
|
{
|
||||||
|
hasEliminateAll = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (game.plus != PLUS_NONE)
|
if (game.plus != PLUS_NONE)
|
||||||
{
|
{
|
||||||
o->required = 1;
|
o->required = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
world.numObjectives++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (game.plus == PLUS_PLUS_PLUS)
|
if (game.plus == PLUS_PLUS_PLUS && !hasEliminateAll)
|
||||||
{
|
{
|
||||||
o = malloc(sizeof(Objective));
|
o = malloc(sizeof(Objective));
|
||||||
memset(o, 0, sizeof(Objective));
|
memset(o, 0, sizeof(Objective));
|
||||||
|
@ -227,7 +238,11 @@ static void loadObjectives(cJSON *root)
|
||||||
|
|
||||||
STRNCPY(o->id, "O99", MAX_NAME_LENGTH);
|
STRNCPY(o->id, "O99", MAX_NAME_LENGTH);
|
||||||
STRNCPY(o->targetName, "ENEMY", MAX_NAME_LENGTH);
|
STRNCPY(o->targetName, "ENEMY", MAX_NAME_LENGTH);
|
||||||
STRNCPY(o->description, "Eliminate all enemies", MAX_DESCRIPTION_LENGTH);
|
STRNCPY(o->description, _("Defeat enemies"), MAX_DESCRIPTION_LENGTH);
|
||||||
o->required = 1;
|
o->required = 1;
|
||||||
|
|
||||||
|
world.minEnemySpawnTime = world.maxEnemySpawnTime = 0;
|
||||||
|
|
||||||
|
world.numObjectives++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue