From f5b873564ae723cbaae678a4357ec7b543499524 Mon Sep 17 00:00:00 2001 From: Norby Date: Wed, 22 Mar 2017 02:49:16 +0100 Subject: [PATCH] * Smooth encumbrance system v1.1 --- base/pics/ui/screen.png | Bin 7121 -> 0 bytes base/ufos/ui/equipment.ufo | 18 +++++--- base/ufos/ui/inv_stat.ufo | 28 +++++++++---- src/client/battlescape/cl_actor.cpp | 75 ++++++++++++++++++++++------------ src/client/battlescape/cl_actor.h | 1 + src/client/battlescape/cl_hud.cpp | 18 +++++--- src/client/cl_inventory_callbacks.cpp | 25 +++++++++--- src/client/cl_video.cpp | 6 ++- src/game/g_health.cpp | 10 +++++ src/game/g_match.cpp | 2 +- src/game/q_shared.h | 15 ++++++- 11 files changed, 142 insertions(+), 56 deletions(-) delete mode 100644 base/pics/ui/screen.png diff --git a/base/pics/ui/screen.png b/base/pics/ui/screen.png deleted file mode 100644 index 55dcacd4f5878b766334ff0a99baafb1fd9f8c6c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7121 zcmV;?8!qIDP)~6*G?(XhRQ0!#B`R%p#w{)#>;@x}B zj(_ZP-=m#%)>%CdIpmOzi6@>oR$6JLSaHP_#T9|$tTA##~c%L z%{5nE=e0H0Tr*BT{q*?lx8LHMZ@!6(FTOa}eD~dVW8;lCj@Mp$EvB1px)@`OG2)(k z?g{^i;iHc}iYK3ZG6oD7kbBKL@4PYf)KkZ1n{AfgPdxF&c<;UUVvl+U1z)HmRq`YUEHzmy6a{E zKKtymc>3w5~(EY3dr>`cVZzIS$Z#;{?-GSF+Uy*57n_~W?#`s?Gu3onez zF1swY*kX$qcieF^IYA8{K0KCLW|{mh3F|Mu_~Nnu{`<$vFTWgPjyYz0|NZxI$|~N^UpL%vLl%3-9e0dB{`e#J`1$9b#|-BA=bw+6W|}F!_~MJW_10Ts zzWL^hrIuPM3)j)nk?45#*=J*lDW=E*bx|&hw#zQNBLzg1?86r@v z2@c#8Ds?i6wHQBab{X1`QgN@V))^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@{apQee6xF|d|^BAC(Z-wHtpj(XjFpbvSRfsSw;`hbeGMeOcV@R}&=8H7R3-yukW zAOPZ^tks7XS(YH{pUkKb3h+!Df-^B;TZS7!DH6M}8E+O;J>5}#0T3`0fHKb$Y-}1s z9fhq2GCGcWPKbDnzx8Yq;&hEro9nH~0h|&1tlRY#zs7h}#woapsZyiFf?nv362@^4 zQ<4H;#~wgeB6a>Zb$K0p6hrcYtdFNb1@s6;@utX&XDqTSng|>zw`@6FR z)Oe(&L*)`U%9VTwN-@9}8fpfSh{74ot&19*s!oKiA&!z)Z0|}dfZ{-{LgwMmV4}0& z>!$jLhWHIC#z&nZZg@{=4JG(PFmbTn<-u=@dkRZOKo3fYoV8RQl4y&Et-hmy02K)2 zOBg{{*SQGQ7L$85LFXwu%XA-FaS$}%8sP4CandY>6{o|IFNjib_qBTO-=_Q&pKAchqxs3gQy zpI;EKF`ILk8E6;Yqow_!Qv+CK{o@F(QEvosh8%^vhMN3`(`I+U^HFdCK~R<)H?SFs z=)9AZYi#Uwi}6`p)*Ub-FuDu+3a6M<*QO>m;s)Nj=kE#*d7edh4e|)B$LSRd-b1PB zj@{Y|D$Ou{XRCNFE{HIT&<{mG8|Xnx8lmxB6zTA9hDLXFp#u!Tgzwr+F!TVw`MGYJ z1wfZbSxCkG-6oEl^=uyW9FPd8stXb|3{m(@Ph6vjx+@rhXYym41ka>K5Lqb;L<8vX zuR(AeYT2KGN0ALZ&Lyaanw+TKQd1!JaT-syI0H0x{nz > 0 ) { *node:parent.bt_load@color = "0 1 0 1" } - elif ( <3> < 0 ) { *node:parent.bt_load@color = "1 1 0 1" } - else { *node:parent.bt_load@color = "1 1 1 1" } + if ( <5> > 8 ) { *node:parent.bt_load@color = "0.5 0 0 1" } //darkest red + elif ( <5> > 7 ) { *node:parent.bt_load@color = "0.6 0 0 1" } //darker red + elif ( <5> > 6 ) { *node:parent.bt_load@color = "0.7 0 0 1" } //dark red + elif ( <5> > 5 ) { *node:parent.bt_load@color = "1 0 0 1" } //red + elif ( <5> > 4 ) { *node:parent.bt_load@color = "1 0.4 0 1" } //dark orange + elif ( <5> > 3 ) { *node:parent.bt_load@color = "1 0.7 0 1" } //orange + elif ( <3> < 0 ) { *node:parent.bt_load@color = "1 1 0 1" } //yellow + elif ( <3> > 0 ) { *node:parent.bt_load@color = "0 1 0 1" } //green + else { *node:parent.bt_load@color = "0.56 0.81 0.76 1" } //ufo2.6 theme color if ( <4> > 0 ) { *node:parent.bt_load@flash = true } else { *node:parent.bt_load@flash = false } } diff --git a/base/ufos/ui/inv_stat.ufo b/base/ufos/ui/inv_stat.ufo index 37f6c88611..8a9ac3962c 100644 --- a/base/ufos/ui/inv_stat.ufo +++ b/base/ufos/ui/inv_stat.ufo @@ -79,12 +79,12 @@ local inv_stats_hud = ufox.build_window({ { name = "bt_load", class = "button", - pos = {255, 35}, - contentalign = ufo.ALIGN_CL, - text = "_0/0 Kg", + pos = {65, 36}, + contentalign = ufo.ALIGN_CR, + text = "_0/0 Kg 0 TU (+0)", color = {0.56, 0.81, 0.76, 1}, - flashcolor = {1, 0, 0, 1}, - size = {106, 25}, + flashcolor = {1, 0.5, 0.5, 1}, + size = {306, 25}, on_click = function (sender) ufo.cmd("hud_updateactorload;") end }, { @@ -237,13 +237,25 @@ local inv_stats_hud = ufox.build_window({ { name = "inv_actorload", class = "confunc", - on_click = function (sender, text, tooltip, penalty, warnings) + on_click = function (sender, text, tooltip, penalty, warnings, moveTU) sender:root():child("bt_load"):set_text(text) sender:root():child("bt_load"):set_tooltip(tooltip) - if (penalty > 0) then - sender:root():child("bt_load"):set_color(0, 1, 0, 1) + if (moveTU > 8) then + sender:root():child("bt_load"):set_color(0.5, 0, 0, 1) + elseif (moveTU > 7) then + sender:root():child("bt_load"):set_color(0.6, 0, 0, 1) + elseif (moveTU > 6) then + sender:root():child("bt_load"):set_color(0.7, 0, 0, 1) + elseif (moveTU > 5) then + sender:root():child("bt_load"):set_color(1, 0, 0, 1) + elseif (moveTU > 4) then + sender:root():child("bt_load"):set_color(1, 0.7, 0, 1) + elseif (moveTU > 3) then + sender:root():child("bt_load"):set_color(1, 0.4, 0, 1) elseif (penalty < 0) then sender:root():child("bt_load"):set_color(1, 1, 0, 1) + elseif (penalty > 0) then + sender:root():child("bt_load"):set_color(0, 1, 0, 1) else sender:root():child("bt_load"):set_color(0.56, 0.81, 0.76, 1) end diff --git a/src/client/battlescape/cl_actor.cpp b/src/client/battlescape/cl_actor.cpp index 122a3c0508..dea5e0e912 100644 --- a/src/client/battlescape/cl_actor.cpp +++ b/src/client/battlescape/cl_actor.cpp @@ -299,35 +299,58 @@ void CL_ActorReserveTUs (const le_t* le, const reservation_types_t type, const i float CL_ActorInjuryModifier (const le_t* le, const modifier_types_t type) { float mod = 0; - if (le) { const character_t* chr = CL_ActorGetChr(le); - if (!chr) - return 0; - const BodyData* bodyTemplate = chr->teamDef->bodyTemplate; - for (int bodyPart = 0; bodyPart < bodyTemplate->numBodyParts(); ++bodyPart) { - const int threshold = le->maxHP * bodyTemplate->woundThreshold(bodyPart); - const int injury = (le->wounds.woundLevel[bodyPart] + le->wounds.treatmentLevel[bodyPart] * 0.5); - if (injury > threshold) - mod += 2 * bodyTemplate->penalty(bodyPart, type) * injury / le->maxHP; - } + mod = CL_ActorModifier (chr, type); + } + return mod; +} - switch (type) { - case MODIFIER_REACTION: - mod += CL_ActorInjuryModifier(le, MODIFIER_SHOOTING); - break; - case MODIFIER_ACCURACY: - case MODIFIER_SHOOTING: - ++mod; - break; - case MODIFIER_MOVEMENT: - mod = ceil(mod); - break; - default: - Com_Printf("CL_ActorInjuryPenalty: Unused modifier type %i\n", type); - mod = 0; - break; - } +/** + * @brief Returns the modifier of the specified type caused by injury and encumbrance. + * @param[in] chr The actor. + * @param[in] type The modifier type. + * @return The modifier for this actor. + */ +float CL_ActorModifier (const character_t* chr, const modifier_types_t type) +{ + float mod = 0; + float weight = 0.0f; + + if (!chr) + return 0; + const BodyData* bodyTemplate = chr->teamDef->bodyTemplate; + for (int bodyPart = 0; bodyPart < bodyTemplate->numBodyParts(); ++bodyPart) { + const int threshold = chr->maxHP * bodyTemplate->woundThreshold(bodyPart); + const int injury = (chr->wounds.woundLevel[bodyPart] + chr->wounds.treatmentLevel[bodyPart] * 0.5); + if (injury > threshold) + mod += 2 * bodyTemplate->penalty(bodyPart, type) * injury / chr->maxHP; + } + + switch (type) { + case MODIFIER_REACTION: + mod += CL_ActorModifier(chr, MODIFIER_SHOOTING); + break; + case MODIFIER_ACCURACY: + case MODIFIER_SHOOTING: + ++mod; + break; + case MODIFIER_MOVEMENT: + mod = ceil(mod); + //reduce movement speed due to encumbrance + weight = ( chr->inv.getWeight() / chr->score.skills[ABILITY_POWER] ) / WEIGHT_FACTOR; + if( weight > WEIGHT_HEAVY ) mod++; + if( weight >= WEIGHT_RED1 ) mod++; + if( weight >= WEIGHT_RED2 ) mod++; + if( weight >= WEIGHT_RED3 ) mod++; + if( weight >= WEIGHT_RED4 ) mod++; + if( weight >= WEIGHT_RED5 ) mod++; + if( weight > WEIGHT_RED6 ) mod++; + break; + default: + Com_Printf("CL_ActorModifier: Unused modifier type %i\n", type); + mod = 0; + break; } return mod; } diff --git a/src/client/battlescape/cl_actor.h b/src/client/battlescape/cl_actor.h index 4bea2b542a..9458e4d511 100644 --- a/src/client/battlescape/cl_actor.h +++ b/src/client/battlescape/cl_actor.h @@ -82,6 +82,7 @@ void CL_ActorShoot(const le_t* le, const pos3_t at); int CL_ActorGetContainerForReload(Item** ic, const Inventory* inv, const objDef_t* weapon); void CL_ActorPlaySound(const le_t* le, actorSound_t soundType); float CL_ActorInjuryModifier(const le_t* le, const modifier_types_t type); +float CL_ActorModifier(const character_t* chr, const modifier_types_t type); int CL_ActorTimeForFireDef(const le_t* le, const fireDef_t* fd, bool reaction = false); void CL_ActorActionMouse(void); diff --git a/src/client/battlescape/cl_hud.cpp b/src/client/battlescape/cl_hud.cpp index 23a8ce7249..a33b5c367c 100644 --- a/src/client/battlescape/cl_hud.cpp +++ b/src/client/battlescape/cl_hud.cpp @@ -1324,9 +1324,9 @@ static void HUD_UpdateActorLoad_f (void) const character_t* chr = CL_ActorGetChr(selActor); const int invWeight = selActor->inv.getWeight(); const int maxWeight = GAME_GetChrMaxLoad(chr); - const float penalty = GET_ENCUMBRANCE_PENALTY(invWeight, maxWeight); + const float encPenalty = GET_ENCUMBRANCE_PENALTY(invWeight, maxWeight); const int normalTU = GET_TU(chr->score.skills[ABILITY_SPEED], 1.0f - WEIGHT_NORMAL_PENALTY); - const int tus = GET_TU(chr->score.skills[ABILITY_SPEED], penalty); + const int tus = GET_TU(chr->score.skills[ABILITY_SPEED], encPenalty); const int tuPenalty = tus - normalTU; int count = 0; @@ -1352,11 +1352,19 @@ static void HUD_UpdateActorLoad_f (void) if (count > 0) UI_Popup(_("Warning"), popupText); + const int moveTU = TU_MOVE_STRAIGHT + CL_ActorModifier(chr, MODIFIER_MOVEMENT); char label[MAX_VAR]; + Com_sprintf(label, sizeof(label), "%g/%i %s %i %s (%+i) %s: %i", invWeight / WEIGHT_FACTOR, maxWeight, _("Kg"), + tus, _("TU"), tuPenalty, _("Move"), (int)(tus/moveTU) ); + char tooltip[MAX_VAR]; - Com_sprintf(label, sizeof(label), "%g/%i %s", invWeight / WEIGHT_FACTOR, maxWeight, _("Kg")); - Com_sprintf(tooltip, sizeof(tooltip), "%s %i (%+i)", _("TU:"), tus, tuPenalty); - UI_ExecuteConfunc("inv_actorload \"%s\" \"%s\" %f %i", label, tooltip, WEIGHT_NORMAL_PENALTY - (1.0f - penalty), count); + float weight_percent = ((int)(invWeight/maxWeight))/10.0f; + float weight_multiplier = std::min(WEIGHT_MAX_MULTIPLIER, ((int)((1/encPenalty)*10))/10.0f); + Com_sprintf(tooltip, sizeof(tooltip), " %gx %g%% %iTU/%s ", + weight_multiplier, weight_percent, moveTU, _("Move")); + + //call inv_actorload in base/ufos/ui/inv_stat.ufo + UI_ExecuteConfunc("inv_actorload \"%s\" \"%s\" %i %i %i", label, tooltip, tuPenalty, count, moveTU); } /** diff --git a/src/client/cl_inventory_callbacks.cpp b/src/client/cl_inventory_callbacks.cpp index 1c875e8ee7..e186aa8a41 100644 --- a/src/client/cl_inventory_callbacks.cpp +++ b/src/client/cl_inventory_callbacks.cpp @@ -29,6 +29,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "ui/ui_nodes.h" #include "cgame/cl_game.h" #include "ui/ui_popup.h" +#include "renderer/r_image.h" +#include "renderer/r_model.h" +#include "cl_renderer.h" +#include "battlescape/cl_localentity.h" +#include "battlescape/cl_actor.h" static const objDef_t* currentDisplayedObject; static int itemIndex; @@ -349,6 +354,7 @@ static void INV_UpdateObject_f (void) INV_ItemDescription(obj); } + /** * @brief Update the equipment weight for the selected actor. */ @@ -365,9 +371,9 @@ static void INV_UpdateActorLoad_f (void) const float invWeight = chr->inv.getWeight(); const int maxWeight = GAME_GetChrMaxLoad(chr); - const float penalty = GET_ENCUMBRANCE_PENALTY(invWeight, maxWeight); + const float encPenalty = GET_ENCUMBRANCE_PENALTY(invWeight, maxWeight); const int normalTU = GET_TU(chr->score.skills[ABILITY_SPEED], 1.0f - WEIGHT_NORMAL_PENALTY); - const int tus = GET_TU(chr->score.skills[ABILITY_SPEED], penalty); + const int tus = GET_TU(chr->score.skills[ABILITY_SPEED], encPenalty); const int tuPenalty = tus - normalTU; int count = 0; @@ -396,12 +402,19 @@ static void INV_UpdateActorLoad_f (void) if ((Cmd_Argc() < 3 || atoi(Cmd_Argv(2)) == 0) && count > 0) UI_Popup(_("Warning"), popupText); + const int moveTU = TU_MOVE_STRAIGHT + CL_ActorModifier(chr, MODIFIER_MOVEMENT); char label[MAX_VAR]; + Com_sprintf(label, sizeof(label), "%g/%i %s %i %s (%+i) %s: %i", invWeight / WEIGHT_FACTOR, maxWeight, _("Kg"), + tus, _("TU"), tuPenalty, _("Move"), (int)(tus/moveTU) ); + char tooltip[MAX_VAR]; - Com_sprintf(label, sizeof(label), "%g/%i %s %s", invWeight / WEIGHT_FACTOR, maxWeight, _("Kg"), - (count > 0 ? _("Warning!") : "")); - Com_sprintf(tooltip, sizeof(tooltip), "%s %i (%+i)", _("TU:"), tus, tuPenalty); - UI_ExecuteConfunc("%s \"%s\" \"%s\" %f %i", Cmd_Argv(1), label, tooltip, WEIGHT_NORMAL_PENALTY - (1.0f - penalty), count); + float weight_percent = ((int)(invWeight/maxWeight))/10.0f; + float weight_multiplier = std::min(WEIGHT_MAX_MULTIPLIER, ((int)((1/encPenalty)*10))/10.0f); + Com_sprintf(tooltip, sizeof(tooltip), " %gx %g%% %iTU/%s ", + weight_multiplier, weight_percent, moveTU, _("Move")); + + //call equip_actorload in base/ufos/ui/equipment.ufo + UI_ExecuteConfunc("%s \"%s\" \"%s\" %i %i %i", Cmd_Argv(1), label, tooltip, tuPenalty, count, moveTU); } void INV_InitCallbacks (void) diff --git a/src/client/cl_video.cpp b/src/client/cl_video.cpp index 0e75ae2831..96ffa125a9 100644 --- a/src/client/cl_video.cpp +++ b/src/client/cl_video.cpp @@ -71,8 +71,10 @@ static const vidmode_t vid_modes[] = { 1440, 900, 21 }, { 1024, 600, 22 }, /* EEE PC */ { 800, 480, 23 }, /* OpenPandora */ - { 1920, 1080, 24 }, /* 1080p */ - { 1366, 768, 25 } + { 1920, 1080, 24 }, /* 1080p */ + { 1366, 768, 25 }, + { 2048, 1152, 26 }, /* Samsung SyncMaster 2343 */ + { 3840, 2160, 27 } /* UHD TV */ }; /** diff --git a/src/game/g_health.cpp b/src/game/g_health.cpp index 83e02b7284..d94a181344 100644 --- a/src/game/g_health.cpp +++ b/src/game/g_health.cpp @@ -182,6 +182,7 @@ void G_SendWoundStats (Edict* const ent) float G_ActorGetInjuryPenalty (const Edict* const ent, const modifier_types_t type) { float penalty = 0; + float weight = 0.0f; const teamDef_t* const teamDef = ent->chr.teamDef; for (int bodyPart = 0; bodyPart < teamDef->bodyTemplate->numBodyParts(); ++bodyPart) { @@ -205,6 +206,15 @@ float G_ActorGetInjuryPenalty (const Edict* const ent, const modifier_types_t ty break; case MODIFIER_MOVEMENT: penalty = ceil(penalty); + //reduce movement speed due to encumbrance + weight = ( ent->chr.inv.getWeight() / ent->chr.score.skills[ABILITY_POWER] ) / WEIGHT_FACTOR; + if( weight > WEIGHT_HEAVY ) penalty++; + if( weight >= WEIGHT_RED1 ) penalty++; + if( weight >= WEIGHT_RED2 ) penalty++; + if( weight >= WEIGHT_RED3 ) penalty++; + if( weight >= WEIGHT_RED4 ) penalty++; + if( weight >= WEIGHT_RED5 ) penalty++; + if( weight > WEIGHT_RED6 ) penalty++; break; default: gi.DPrintf("G_ActorGetInjuryPenalty: Unknown modifier type %i\n", type); diff --git a/src/game/g_match.cpp b/src/game/g_match.cpp index d7e2b1bae8..2bff9a3fa5 100644 --- a/src/game/g_match.cpp +++ b/src/game/g_match.cpp @@ -48,7 +48,7 @@ static int G_GetEarnedExperience (abilityskills_t skill, Edict* ent) switch (skill) { case ABILITY_POWER: { const float weight = chr->scoreMission->carriedWeight / level.actualRound; - const float penalty = GET_ENCUMBRANCE_PENALTY(weight, chr->score.skills[ABILITY_POWER]); + const float penalty = std::min(1/WEIGHT_MAX_MULTIPLIER, GET_ENCUMBRANCE_PENALTY(weight, chr->score.skills[ABILITY_POWER])); experience = 50 * (weight / WEIGHT_FACTOR / chr->score.skills[ABILITY_POWER]) / penalty; break; } diff --git a/src/game/q_shared.h b/src/game/q_shared.h index ed3c0c3f2d..e57327e79e 100644 --- a/src/game/q_shared.h +++ b/src/game/q_shared.h @@ -280,15 +280,26 @@ typedef int32_t shoot_types_t; #define MIN_TU 39 #define WEIGHT_LIGHT 0.2f #define WEIGHT_HEAVY 0.5f +#define WEIGHT_RED1 0.66f +#define WEIGHT_RED2 0.74f +#define WEIGHT_RED3 0.82f +#define WEIGHT_RED4 0.9f +#define WEIGHT_RED5 0.94f +#define WEIGHT_RED6 0.98f + #define WEIGHT_NORMAL_PENALTY 0.3f #define WEIGHT_HEAVY_PENALTY 0.6f #define WEIGHT_FACTOR 1000.0f +#define WEIGHT_MAX_MULTIPLIER 2.5f -#define GET_ENCUMBRANCE_PENALTY(weight, max) (1.0f - ((weight) > (max) * WEIGHT_FACTOR * WEIGHT_HEAVY ? WEIGHT_HEAVY_PENALTY : (weight) > (max) * WEIGHT_FACTOR * WEIGHT_LIGHT ? WEIGHT_NORMAL_PENALTY : 0.0f)) +#define GET_ENCUMBRANCE_LEVEL(weight, max) (1.0f - ((weight) > (max) * WEIGHT_FACTOR * WEIGHT_HEAVY ? WEIGHT_HEAVY_PENALTY : (weight) > (max) * WEIGHT_FACTOR * WEIGHT_LIGHT ? WEIGHT_NORMAL_PENALTY : 0.0f)) +#define GET_ENCUMBRANCE_PENALTY(weight, max) (1.0f - (12.0f/MIN_TU-((0.5f-(weight/(max*WEIGHT_FACTOR)))/0.04f)/MIN_TU) ) +#define GET_ENCUMBRANCE_PENALTY2(weight, max) (1.0f - ((weight) > (max) * WEIGHT_FACTOR * WEIGHT_HEAVY ? 12.0f/MIN_TU+(((weight/(max*WEIGHT_FACTOR))-0.5f)/0.02f)/MIN_TU : 12.0f/MIN_TU-((0.5f-(weight/(max*WEIGHT_FACTOR)))/0.04f)/MIN_TU )) /** @todo Skill-influence needs some balancing. */ #define GET_ACC( ab, sk, pn ) ((pn) - (((float)(ab) - 10) / (MAX_SKILL / 2) + ((float)(sk) - 10) / (MAX_SKILL / 2)) / 2) #define GET_MORALE( ab ) (std::min((100 + (ab) * 150/MAX_SKILL), 255)) -#define GET_TU( ab, md ) (MIN_TU * (md) + (ab) * 20 / MAX_SKILL) +#define GET_TU( ab, md ) (MIN_TU * (md) + (ab) * 20 / MAX_SKILL) +#define GET_TU_TO2TU( ab, md ) (MIN_TU * (md) + (ab) * 20 / MAX_SKILL * std::min( 1.0f, (md) * (1 / GET_ENCUMBRANCE_PENALTY(WEIGHT_FACTOR * WEIGHT_HEAVY, 1)))) #define DOOR_OPEN_REVERSE 4 #define GET_SLIDING_DOOR_SHIFT_VECTOR(dir, speed, vecout) \ -- 2.11.0