From 2632c98c980e223108d89e2347294239c100876a Mon Sep 17 00:00:00 2001 From: fl0werD Date: Fri, 13 Sep 2019 22:07:52 +0400 Subject: [PATCH] add prevent jump flag to iuser3 data (#410) * add prevent jump flag to iuser3 data --- regamedll/dlls/cdll_dll.h | 1 + regamedll/pm_shared/pm_shared.cpp | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/regamedll/dlls/cdll_dll.h b/regamedll/dlls/cdll_dll.h index 2e3b42de..de8f386e 100644 --- a/regamedll/dlls/cdll_dll.h +++ b/regamedll/dlls/cdll_dll.h @@ -72,6 +72,7 @@ const int DEFAULT_FOV = 90; // the default field of view #define PLAYER_HOLDING_SHIELD BIT(3) #define PLAYER_PREVENT_DUCK BIT(4) #define PLAYER_PREVENT_CLIMB BIT(5) // The player can't climb ladder +#define PLAYER_PREVENT_JUMP BIT(6) #define MENU_KEY_1 BIT(0) #define MENU_KEY_2 BIT(1) diff --git a/regamedll/pm_shared/pm_shared.cpp b/regamedll/pm_shared/pm_shared.cpp index 77d483c1..be0374ba 100644 --- a/regamedll/pm_shared/pm_shared.cpp +++ b/regamedll/pm_shared/pm_shared.cpp @@ -1880,7 +1880,7 @@ void PM_Duck() pmove->oldbuttons &= ~IN_DUCK; } -#ifdef REGAMEDLL_FIXES +#ifdef REGAMEDLL_ADD // Prevent ducking if the iuser3 variable is contain PLAYER_PREVENT_DUCK if ((pmove->iuser3 & PLAYER_PREVENT_DUCK) == PLAYER_PREVENT_DUCK) { @@ -2400,6 +2400,14 @@ void PM_Jump() return; } +#ifdef REGAMEDLL_ADD + // Prevent jumping if the iuser3 variable is contain PLAYER_PREVENT_JUMP + if ((pmove->iuser3 & PLAYER_PREVENT_JUMP) == PLAYER_PREVENT_JUMP) + { + return; + } +#endif + // No more effect // in air, so no effect if (pmove->onground == -1)