From 0f7d4fd2149d4bf45833b7695945aca317991c44 Mon Sep 17 00:00:00 2001 From: Marco Cawthorne Date: Thu, 26 May 2022 17:42:35 -0700 Subject: [PATCH] prop_vehicle_drivable: Add spawnflag VEHSF_NOFLIP, which will prevent the vehicle from flipping over --- src/gs-entbase/shared/prop_vehicle_driveable.qc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gs-entbase/shared/prop_vehicle_driveable.qc b/src/gs-entbase/shared/prop_vehicle_driveable.qc index a5871756..2ca4a2cb 100644 --- a/src/gs-entbase/shared/prop_vehicle_driveable.qc +++ b/src/gs-entbase/shared/prop_vehicle_driveable.qc @@ -32,6 +32,8 @@ This entity was introduced in Half-Life 2 (2004). #define VEH_SKIDDING FL_USE_RELEASED +#define VEHSF_NOFLIP 2048 + enumflags { VEHFL_DRIVER, @@ -579,6 +581,11 @@ prop_vehicle_driveable::RunVehiclePhysics(void) PlayerUpdateFlags(); } + if (spawnflags & VEHSF_NOFLIP) { + angles[0] = bound (-45, angles[0], 45); + angles[2] = bound (-45, angles[2], 45); + } + flags &= ~VEH_SKIDDING; angles[0] = Math_FixDelta(angles[0]);