Medical GUI - Add ability to customize Medical GUI colors (#8350)

* Add ability to customize colors of injuries

Added CBA settings entries.
Updated default values.
Added English and Russian locales.

* copypaste cleanup

* move comments and make code more maintainable

* Apply suggestions from code review

Newline at end of files

Co-authored-by: Dedmen Miller <dedmen@users.noreply.github.com>

Co-authored-by: Dedmen Miller <dedmen@users.noreply.github.com>
This commit is contained in:
Serg Vergun 2021-10-12 11:11:55 +03:00 committed by GitHub
parent 374a5b632f
commit f7b07c362d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 82 additions and 28 deletions

View File

@ -2,8 +2,6 @@
/*
* Author: ShackTac, SilentSpike
* Converts a blood loss value into a representative RGBA colour.
* Blood loss colouring follows a "white, yellow, red" colour scale with 10 steps, Bezier interpolation and Correct lightness gradient.
* See: https://gka.github.io/palettes
*
* Arguments:
* 0: The blood loss value (range [0,1]) <NUMBER>
@ -22,15 +20,4 @@ params ["_bloodLoss"];
private _frBL = 0 max (_bloodLoss / BLOOD_LOSS_RED_THRESHOLD) min 1;
private _colorInt = ceil (_frBL * (BLOOD_LOSS_TOTAL_COLORS - 1));
[
[1.00, 1.00, 1.00, 1], // #ffffff
[1.00, 0.95, 0.63, 1], // #fff1a1
[1.00, 0.88, 0.46, 1], // #ffe075
[1.00, 0.80, 0.33, 1], // #ffcb55
[1.00, 0.72, 0.24, 1], // #ffb73c
[1.00, 0.63, 0.15, 1], // #ffa127
[1.00, 0.53, 0.08, 1], // #ff8815
[1.00, 0.43, 0.02, 1], // #ff6d05
[1.00, 0.29, 0.00, 1], // #ff4b00
[1.00, 0.00, 0.00, 1] // #ff0000
] select _colorInt;
missionNamespace getVariable format ["%1_%2", QGVAR(bloodLossColor), _colorInt]

View File

@ -2,8 +2,6 @@
/*
* Author: ShackTac, SilentSpike
* Converts a damage value into a representative RGBA colour.
* Damage colouring follows a "white, cyan, blue" colour scale with 10 steps, Bezier interpolation and Correct lightness gradient.
* See: https://gka.github.io/palettes
*
* Arguments:
* 0: The damage value (range [0,1]) <NUMBER>
@ -22,15 +20,4 @@ params ["_damage"];
private _frD = 0 max (_damage / DAMAGE_BLUE_THRESHOLD) min 1;
private _colorInt = ceil (_frD * (DAMAGE_TOTAL_COLORS - 1));
[
[1.00, 1.00, 1.00, 1], // #ffffff
[0.75, 0.95, 1.00, 1], // #bff2ff
[0.63, 0.87, 1.00, 1], // #a0ddff
[0.54, 0.77, 1.00, 1], // #8ac4ff
[0.48, 0.67, 1.00, 1], // #7aacff
[0.42, 0.57, 1.00, 1], // #6c91ff
[0.37, 0.47, 1.00, 1], // #5e77ff
[0.31, 0.35, 1.00, 1], // #4e5aff
[0.22, 0.23, 1.00, 1], // #383bff
[0.00, 0.00, 1.00, 1] // #0000ff
] select _colorInt
missionNamespace getVariable format ["%1_%2", QGVAR(damageColor), _colorInt]

View File

@ -51,3 +51,59 @@
[[0, 1, 2], [ELSTRING(common,Disabled), ELSTRING(Medical_Treatment,Anyone), ELSTRING(Medical_Treatment,Medics)], 1],
false
] call CBA_fnc_addSetting;
/*
* Default blood loss colouring follows a "white, yellow, red" colour scale with 10 steps, Bezier interpolation and Correct lightness gradient.
* See: https://gka.github.io/palettes
*/
private _bloodLossColors = [
[1.00, 1.00, 1.00, 1],
[1.00, 0.95, 0.64, 1],
[1.00, 0.87, 0.46, 1],
[1.00, 0.80, 0.33, 1],
[1.00, 0.72, 0.24, 1],
[1.00, 0.63, 0.15, 1],
[1.00, 0.54, 0.08, 1],
[1.00, 0.43, 0.02, 1],
[1.00, 0.30, 0.00, 1],
[1.00, 0.00, 0.00, 1]
];
/*
* Default damage colouring follows a "white, cyan, blue" colour scale with 10 steps, Bezier interpolation and Correct lightness gradient.
* See: https://gka.github.io/palettes
*/
private _damageColors = [
[1.00, 1.00, 1.00, 1],
[0.75, 0.95, 1.00, 1],
[0.62, 0.86, 1.00, 1],
[0.54, 0.77, 1.00, 1],
[0.48, 0.67, 1.00, 1],
[0.42, 0.57, 1.00, 1],
[0.37, 0.47, 1.00, 1],
[0.31, 0.36, 1.00, 1],
[0.22, 0.23, 1.00, 1],
[0.00, 0.00, 1.00, 1]
];
{
[
format ["%1_%2", QGVAR(bloodLossColor), _forEachIndex],
"COLOR",
[format [localize LSTRING(BloodLossColorX_DisplayName), _forEachIndex], LSTRING(BloodLossColor_Description)],
[ELSTRING(medical,Category), LSTRING(BloodLossColors)],
_x,
false // isGlobal
] call CBA_fnc_addSetting;
} forEach _bloodLossColors;
{
[
format ["%1_%2", QGVAR(damageColor), _forEachIndex],
"COLOR",
[format [localize LSTRING(DamageColorX_DisplayName), _forEachIndex], LSTRING(DamageColor_Description)],
[ELSTRING(medical,Category), LSTRING(DamageColors)],
_x,
false // isGlobal
] call CBA_fnc_addSetting;
} forEach _damageColors;

View File

@ -1126,5 +1126,29 @@
<Turkish>Hasta Bilgileri</Turkish>
<Spanish>Información de paciente</Spanish>
</Key>
<Key ID="STR_ACE_Medical_GUI_BloodLossColors">
<English>Blood Loss Colors</English>
<Russian>Цвета кровопотери</Russian>
</Key>
<Key ID="STR_ACE_Medical_GUI_BloodLossColor_Description">
<English>Blood Loss Colors, That Used in Medical GUI. 10 Color Gradient.</English>
<Russian>Цвета кровопотери, которые используются в Медицинском интерфейсе. Градиент из 10 цветов.</Russian>
</Key>
<Key ID="STR_ACE_Medical_GUI_BloodLossColorX_DisplayName">
<English>Blood Loss Color %1</English>
<Russian>Цвет кровопотери %1</Russian>
</Key>
<Key ID="STR_ACE_Medical_GUI_DamageColors">
<English>Damage Colors</English>
<Russian>Цвета урона</Russian>
</Key>
<Key ID="STR_ACE_Medical_GUI_DamageColor_Description">
<English>Damage Colors, That Used in Medical GUI. 10 Color Gradient.</English>
<Russian>Цвета урона, которые используются в Медицинском интерфейсе. Градиент из 10 цветов.</Russian>
</Key>
<Key ID="STR_ACE_Medical_GUI_DamageColorX_DisplayName">
<English>Damage Color %1</English>
<Russian>Цвет урона %1</Russian>
</Key>
</Package>
</Project>