ACE3/addons/medical_gui/functions/fnc_damageToRGBA.sqf

37 lines
1.0 KiB
Plaintext
Raw Normal View History

Rewrite Medical GUI (#6831) * Add a macro for the bloodloss scaling factor * Adjust bloodloss threshold for red icon * Remove bloodloss color scaling factor The issue is actually the other way round, the factor of 20 would instantly make bodyparts red on taking a wound. * Implemet 10 color steps provided by ShackTac This replaces the old method of colouring the interaction menu icons and body image selections with a new method that has 10 distinct color steps (matching across the icons and the body image). * Use macros for constants * Implement blue damage colouring This re-adds visualisation for colouring based on damage. The case where a limb has a tourniquet will hopefully be handled by an overlayed icon. * Tidy up file structure * Move patient information display to medical_ui * Make common colour conversion code into functions * Add tourniquet icon overlay to body image * Fix mispelling I forgot to commit * Update icon paths to new white cross icon * Clean mess after rebase * Add new medical menu gui * Add updating injury list and body image * Add updating treatment category buttons * Update onMenuClose function * Delete unused functions * Add action buttons and triage card to menu * Move medical menu PFH to separate function * Move setTriageStatus to treatment * Add triage select dropdown * Add toggle button action * Fix mouse moving randomly when opening * Add logs list update and remove unused functions * Hide tourniquet icons by default * Remove CfgInGameUI (already in feedback) * Update patient info display * Update triage card display * Add settings to control interact menu actions * Cleanup files/paths * Move triage status update to common function * Add icons for interact menu actions * Modify icon color for interact menu actions * Update canOpenMenu for new setting * Hide pain information for unconscious * Stringtable cleanup * Use switch for pain text * Change minor triage status to minimal * Fix injury list to use new stringtable entry names * Fix medical actions check when disabled * Skip distance check in same vehicle * More cleanup * Fix CI error * Requested changes * Fix INJURIES string * Fix include after comment block * Fix missing ; Co-Authored-By: mharis001 <34453221+mharis001@users.noreply.github.com>
2019-03-24 22:17:48 +00:00
#include "script_component.hpp"
/*
* 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>
*
* Return Value:
* Representative RGBA colour <ARRAY>
*
* Example:
2019-03-30 16:07:54 +00:00
* [0.4] call ace_medical_gui_fnc_damageToRGBA
Rewrite Medical GUI (#6831) * Add a macro for the bloodloss scaling factor * Adjust bloodloss threshold for red icon * Remove bloodloss color scaling factor The issue is actually the other way round, the factor of 20 would instantly make bodyparts red on taking a wound. * Implemet 10 color steps provided by ShackTac This replaces the old method of colouring the interaction menu icons and body image selections with a new method that has 10 distinct color steps (matching across the icons and the body image). * Use macros for constants * Implement blue damage colouring This re-adds visualisation for colouring based on damage. The case where a limb has a tourniquet will hopefully be handled by an overlayed icon. * Tidy up file structure * Move patient information display to medical_ui * Make common colour conversion code into functions * Add tourniquet icon overlay to body image * Fix mispelling I forgot to commit * Update icon paths to new white cross icon * Clean mess after rebase * Add new medical menu gui * Add updating injury list and body image * Add updating treatment category buttons * Update onMenuClose function * Delete unused functions * Add action buttons and triage card to menu * Move medical menu PFH to separate function * Move setTriageStatus to treatment * Add triage select dropdown * Add toggle button action * Fix mouse moving randomly when opening * Add logs list update and remove unused functions * Hide tourniquet icons by default * Remove CfgInGameUI (already in feedback) * Update patient info display * Update triage card display * Add settings to control interact menu actions * Cleanup files/paths * Move triage status update to common function * Add icons for interact menu actions * Modify icon color for interact menu actions * Update canOpenMenu for new setting * Hide pain information for unconscious * Stringtable cleanup * Use switch for pain text * Change minor triage status to minimal * Fix injury list to use new stringtable entry names * Fix medical actions check when disabled * Skip distance check in same vehicle * More cleanup * Fix CI error * Requested changes * Fix INJURIES string * Fix include after comment block * Fix missing ; Co-Authored-By: mharis001 <34453221+mharis001@users.noreply.github.com>
2019-03-24 22:17:48 +00:00
*
* Public: No
*/
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