Added healthBars option to gameplay features.

This commit is contained in:
Steve 2016-05-01 16:35:11 +01:00
parent 9c113f2263
commit c87c95fbde
4 changed files with 6 additions and 2 deletions

View File

@ -37,6 +37,7 @@
"gameplay" : {
"friendlyFire" : 0,
"autoSwitchPlayerTarget" : 0,
"missileReTarget" : 0
"missileReTarget" : 0,
"healthBars" : 0
}
}

View File

@ -425,7 +425,7 @@ static void drawHealthBar(Entity *e)
{
SDL_Rect r;
if (!(e->flags & EF_NO_HEALTH_BAR) && e->health > 0)
if (app.gameplay.healthBars && !(e->flags & EF_NO_HEALTH_BAR) && e->health > 0)
{
r.x = e->x - (e->w / 2) - battle.camera.x;
r.y = e->y - e->h - battle.camera.y;

View File

@ -387,6 +387,7 @@ typedef struct {
int friendlyFire;
int autoSwitchPlayerTarget;
int missileReTarget;
int healthBars;
} Gameplay;
typedef struct {

View File

@ -267,6 +267,7 @@ static void loadConfigFile(char *filename)
app.gameplay.friendlyFire = cJSON_GetObjectItem(gameplayJSON, "friendlyFire")->valueint;
app.gameplay.autoSwitchPlayerTarget = cJSON_GetObjectItem(gameplayJSON, "autoSwitchPlayerTarget")->valueint;
app.gameplay.missileReTarget = cJSON_GetObjectItem(gameplayJSON, "missileReTarget")->valueint;
app.gameplay.healthBars = cJSON_GetObjectItem(gameplayJSON, "healthBars")->valueint;
}
cJSON_Delete(root);
@ -311,6 +312,7 @@ void saveConfig(void)
cJSON_AddNumberToObject(gameplayJSON, "friendlyFire", app.gameplay.friendlyFire);
cJSON_AddNumberToObject(gameplayJSON, "autoSwitchPlayerTarget", app.gameplay.autoSwitchPlayerTarget);
cJSON_AddNumberToObject(gameplayJSON, "missileReTarget", app.gameplay.missileReTarget);
cJSON_AddNumberToObject(gameplayJSON, "healthBars", app.gameplay.healthBars);
cJSON_AddItemToObject(root, "gameplay", gameplayJSON);
out = cJSON_Print(root);