mirror of
https://github.com/LostArtefacts/TRX.git
synced 2025-05-02 14:47:58 +03:00
streamline bar flashing modes (closes #35)
This commit is contained in:
parent
7c8cdb3ba0
commit
d830dba34b
4 changed files with 32 additions and 18 deletions
|
@ -54,11 +54,14 @@
|
|||
|
||||
// Changes how the healthbar is displayed. Possible values:
|
||||
// - always: always show the healthbar
|
||||
// - flashing: show the healthbar only when Lara's health is 20% or below
|
||||
// - default: show the healthbar at the beginning of a level, after
|
||||
// getting hit or while having weapons equipped (as in OG)
|
||||
// - flashing-or-default: show the healthbar when Lara's health is 20% or
|
||||
// below, or under default circumstances
|
||||
// - flashing-only: show the healthbar *only* when Lara's health is 20% or
|
||||
// below (useful for challenge runs)
|
||||
// - never: never display the healthbar (for challenge runs)
|
||||
"healthbar_showing_mode": "flashing",
|
||||
"healthbar_showing_mode": "flashing-or-default",
|
||||
|
||||
// Location where the healthbar is displayed. Possible values:
|
||||
// - top-left
|
||||
|
@ -83,9 +86,15 @@
|
|||
|
||||
// Changes how the airbar is displayed. Possible values:
|
||||
// - always: always show the airbar
|
||||
// - flashing: show the airbar only when Lara's oxygen is 20% or below
|
||||
// - default: show the airbar only in the water
|
||||
// - flashing-or-default: show the airbar when Lara's oxygen is 20% or
|
||||
/ below or under normal circumstances
|
||||
// - flashing-only: show the airbar *only* when Lara's oxygen is 20% or /
|
||||
// below (useful for challenge runs)
|
||||
// - never: never display the airbar (for challenge runs)
|
||||
// In case of airbar, the flashing-or-default mode is there mostly for
|
||||
// consistency and the only practical difference is that it's shown when
|
||||
// Lara dies. When using the fly cheat, the airbar is never shown.
|
||||
"airbar_showing_mode": "default",
|
||||
|
||||
// Location where the airbar is displayed.
|
||||
|
|
|
@ -15,8 +15,10 @@ static int8_t ReadBarShowingMode(struct json_value_s* root, const char* name)
|
|||
const char* value_str = JSONGetStringValue(root, name);
|
||||
if (!value_str) {
|
||||
return T1M_BSM_DEFAULT;
|
||||
} else if (!strcmp(value_str, "flashing")) {
|
||||
return T1M_BSM_FLASHING;
|
||||
} else if (!strcmp(value_str, "flashing-or-default")) {
|
||||
return T1M_BSM_FLASHING_OR_DEFAULT;
|
||||
} else if (!strcmp(value_str, "flashing-only")) {
|
||||
return T1M_BSM_FLASHING_ONLY;
|
||||
} else if (!strcmp(value_str, "always")) {
|
||||
return T1M_BSM_ALWAYS;
|
||||
} else if (!strcmp(value_str, "never")) {
|
||||
|
|
|
@ -26,9 +26,10 @@ typedef enum {
|
|||
|
||||
typedef enum {
|
||||
T1M_BSM_DEFAULT = 0,
|
||||
T1M_BSM_FLASHING = 1,
|
||||
T1M_BSM_ALWAYS = 2,
|
||||
T1M_BSM_NEVER = 3,
|
||||
T1M_BSM_FLASHING_OR_DEFAULT = 1,
|
||||
T1M_BSM_FLASHING_ONLY = 2,
|
||||
T1M_BSM_ALWAYS = 3,
|
||||
T1M_BSM_NEVER = 4,
|
||||
} T1M_BAR_SHOW_MODE;
|
||||
|
||||
struct {
|
||||
|
|
|
@ -58,11 +58,12 @@ void DrawHealthBar()
|
|||
break;
|
||||
case T1M_BSM_NEVER:
|
||||
show = 0;
|
||||
return;
|
||||
case T1M_BSM_FLASHING:
|
||||
if (hit_points <= (LARA_HITPOINTS * 20) / 100) {
|
||||
show = 1;
|
||||
}
|
||||
break;
|
||||
case T1M_BSM_FLASHING_OR_DEFAULT:
|
||||
show |= hit_points <= (LARA_HITPOINTS * 20) / 100;
|
||||
break;
|
||||
case T1M_BSM_FLASHING_ONLY:
|
||||
show = hit_points <= (LARA_HITPOINTS * 20) / 100;
|
||||
break;
|
||||
}
|
||||
if (!show) {
|
||||
|
@ -88,11 +89,12 @@ void DrawAirBar()
|
|||
break;
|
||||
case T1M_BSM_NEVER:
|
||||
show = 0;
|
||||
return;
|
||||
case T1M_BSM_FLASHING:
|
||||
if (Lara.air > (LARA_AIR * 20) / 100) {
|
||||
show = 0;
|
||||
}
|
||||
break;
|
||||
case T1M_BSM_FLASHING_OR_DEFAULT:
|
||||
show |= Lara.air <= (LARA_AIR * 20) / 100;
|
||||
break;
|
||||
case T1M_BSM_FLASHING_ONLY:
|
||||
show = Lara.air <= (LARA_AIR * 20) / 100;
|
||||
break;
|
||||
}
|
||||
if (!show) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue