From e9586ebccc16d4c2498854c474a2b185f3bf5642 Mon Sep 17 00:00:00 2001 From: commy2 Date: Thu, 6 Oct 2016 22:40:36 +0200 Subject: [PATCH] use common header file for medical components --- addons/medical/script_component.hpp | 7 +------ .../script_macros_config.hpp} | 2 +- addons/medical/script_macros_medical.hpp | 16 ++++++++++++++++ addons/medical_ai/script_component.hpp | 3 +-- addons/medical_blood/script_component.hpp | 1 + addons/medical_damage/script_component.hpp | 11 +---------- addons/medical_engine/script_component.hpp | 4 ++-- addons/medical_menu/script_component.hpp | 3 +-- addons/medical_treatment/script_component.hpp | 5 +---- addons/medical_ui/script_component.hpp | 1 + 10 files changed, 26 insertions(+), 27 deletions(-) rename addons/{medical_engine/script_macros_medical.hpp => medical/script_macros_config.hpp} (96%) create mode 100644 addons/medical/script_macros_medical.hpp diff --git a/addons/medical/script_component.hpp b/addons/medical/script_component.hpp index 8e9cc6b5fa..c93f584b0c 100644 --- a/addons/medical/script_component.hpp +++ b/addons/medical/script_component.hpp @@ -15,9 +15,4 @@ #endif #include "\z\ace\addons\main\script_macros.hpp" - -#define ALL_BODY_PARTS ["head", "body", "leftarm", "rightarm", "leftleg", "rightleg"] - -// scale received pain to 0-2 level to select type of scream -// below 0.33: 0, from 0.34 to 0.66: 1, more than 0.67: 2 -#define PAIN_TO_MOAN(pain) (floor (3 * pain) min 2) +#include "\z\ace\addons\medical\script_macros_medical.hpp" diff --git a/addons/medical_engine/script_macros_medical.hpp b/addons/medical/script_macros_config.hpp similarity index 96% rename from addons/medical_engine/script_macros_medical.hpp rename to addons/medical/script_macros_config.hpp index 9e66568df1..74aff6b38e 100644 --- a/addons/medical_engine/script_macros_medical.hpp +++ b/addons/medical/script_macros_config.hpp @@ -1,7 +1,7 @@ /* Usage: - #include "\z\ace\addons\medical_engine\script_macros_medical.hpp" + #include "\z\ace\addons\medical\script_macros_config.hpp" class CfgVehicles { class My_AwesomeUnit_base; diff --git a/addons/medical/script_macros_medical.hpp b/addons/medical/script_macros_medical.hpp new file mode 100644 index 0000000000..db1872207f --- /dev/null +++ b/addons/medical/script_macros_medical.hpp @@ -0,0 +1,16 @@ + +#define ALL_BODY_PARTS ["head", "body", "leftarm", "rightarm", "leftleg", "rightleg"] + +#define CUR_LEVEL (["Basic", "Advanced"] select (EGVAR(medical,level) >= 2)) + +// scale received pain to 0-2 level to select type of scream +// below 0.25: 0, from 0.25 to 0.5: 1, more than 0.5: 2 +#define PAIN_TO_SCREAM(pain) (floor (4 * pain) min 2) + +// scale received pain to 0-2 level to select type of scream +// below 0.33: 0, from 0.34 to 0.66: 1, more than 0.67: 2 +#define PAIN_TO_MOAN(pain) (floor (3 * pain) min 2) + +#define GET_NUMBER(config,default) (if (isNumber (config)) then {getNumber (config)} else {default}) +#define GET_STRING(config,default) (if (isText (config)) then {getText (config)} else {default}) +#define GET_ARRAY(config,default) (if (isArray (config)) then {getArray (config)} else {default}) diff --git a/addons/medical_ai/script_component.hpp b/addons/medical_ai/script_component.hpp index b83ce1b5e9..f335b7dc0c 100644 --- a/addons/medical_ai/script_component.hpp +++ b/addons/medical_ai/script_component.hpp @@ -15,5 +15,4 @@ #endif #include "\z\ace\addons\main\script_macros.hpp" - -#define ALL_BODY_PARTS ["head", "body", "leftarm", "rightarm", "leftleg", "rightleg"] +#include "\z\ace\addons\medical\script_macros_medical.hpp" diff --git a/addons/medical_blood/script_component.hpp b/addons/medical_blood/script_component.hpp index d94019a080..313161a7b2 100644 --- a/addons/medical_blood/script_component.hpp +++ b/addons/medical_blood/script_component.hpp @@ -15,6 +15,7 @@ #endif #include "\z\ace\addons\main\script_macros.hpp" +#include "\z\ace\addons\medical\script_macros_medical.hpp" #define MAX_BLOOD_OBJECTS 500 #define BLOOD_OBJECT_LIFETIME 900 diff --git a/addons/medical_damage/script_component.hpp b/addons/medical_damage/script_component.hpp index cab6ac28a0..e38fd550bb 100644 --- a/addons/medical_damage/script_component.hpp +++ b/addons/medical_damage/script_component.hpp @@ -16,13 +16,4 @@ #endif #include "\z\ace\addons\main\script_macros.hpp" - -#define GET_NUMBER(config,default) (if (isNumber (config)) then {getNumber (config)} else {default}) -#define GET_STRING(config,default) (if (isText (config)) then {getText (config)} else {default}) -#define GET_ARRAY(config,default) (if (isArray (config)) then {getArray (config)} else {default}) - -#define ALL_BODY_PARTS ["head", "body", "leftarm", "rightarm", "leftleg", "rightleg"] - -// scale received pain to 0-2 level to select type of scream -// below 0.25: 0, from 0.25 to 0.5: 1, more than 0.5: 2 -#define PAIN_TO_SCREAM(pain) (floor (4 * pain) min 2) +#include "\z\ace\addons\medical\script_macros_medical.hpp" diff --git a/addons/medical_engine/script_component.hpp b/addons/medical_engine/script_component.hpp index 790a5972f3..7f35049b5b 100644 --- a/addons/medical_engine/script_component.hpp +++ b/addons/medical_engine/script_component.hpp @@ -16,8 +16,8 @@ #endif #include "\z\ace\addons\main\script_macros.hpp" - -#include "script_macros_medical.hpp" +#include "\z\ace\addons\medical\script_macros_medical.hpp" +#include "\z\ace\addons\medical\script_macros_config.hpp" #define EMPTY_SOUND {"A3\Sounds_F\dummysound.wss",1,1} #define NAMESPACE_NULL locationNull diff --git a/addons/medical_menu/script_component.hpp b/addons/medical_menu/script_component.hpp index afd49a6920..9997ad43a8 100644 --- a/addons/medical_menu/script_component.hpp +++ b/addons/medical_menu/script_component.hpp @@ -15,5 +15,4 @@ #endif #include "\z\ace\addons\main\script_macros.hpp" - -#define ALL_BODY_PARTS ["head", "body", "leftarm", "rightarm", "leftleg", "rightleg"] +#include "\z\ace\addons\medical\script_macros_medical.hpp" diff --git a/addons/medical_treatment/script_component.hpp b/addons/medical_treatment/script_component.hpp index e8bd99ded7..a667725cec 100644 --- a/addons/medical_treatment/script_component.hpp +++ b/addons/medical_treatment/script_component.hpp @@ -15,7 +15,4 @@ #endif #include "\z\ace\addons\main\script_macros.hpp" - -#define ALL_BODY_PARTS ["head", "body", "leftarm", "rightarm", "leftleg", "rightleg"] - -#define CUR_LEVEL (["Basic", "Advanced"] select (EGVAR(medical,level) >= 2)) +#include "\z\ace\addons\medical\script_macros_medical.hpp" diff --git a/addons/medical_ui/script_component.hpp b/addons/medical_ui/script_component.hpp index 66ffe0f889..7f15f0b8ab 100644 --- a/addons/medical_ui/script_component.hpp +++ b/addons/medical_ui/script_component.hpp @@ -16,3 +16,4 @@ #endif #include "\z\ace\addons\main\script_macros.hpp" +#include "\z\ace\addons\medical\script_macros_medical.hpp"