From ce8ccb737c4c4730e59e520362ba8e78426b44be Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 27 Nov 2022 16:09:36 +1000 Subject: [PATCH] Restore engine refdef support, add a global to toggle it --- qcsrc/lib/csqcmodel/cl_player.qc | 12 ++++++++++++ qcsrc/lib/csqcmodel/cl_player.qh | 2 ++ 2 files changed, 14 insertions(+) diff --git a/qcsrc/lib/csqcmodel/cl_player.qc b/qcsrc/lib/csqcmodel/cl_player.qc index 4331f7310..a92fcc5c5 100644 --- a/qcsrc/lib/csqcmodel/cl_player.qc +++ b/qcsrc/lib/csqcmodel/cl_player.qc @@ -526,6 +526,18 @@ vector CSQCPlayer_ApplyChase(entity this, vector v) void CSQCPlayer_CalcRefdef(entity this) { + if(use_engine_refdef) + { + int refdefflags = 0; + if (this.csqcmodel_teleported) refdefflags |= REFDEFFLAG_TELEPORTED; + if (input_buttons & BIT(1)) refdefflags |= REFDEFFLAG_JUMPING; + // note: these two only work in WIP2, but are harmless in WIP1 + if (PHYS_HEALTH(NULL) <= 0 && PHYS_HEALTH(NULL) != -666 && PHYS_HEALTH(NULL) != -2342) refdefflags |= REFDEFFLAG_DEAD; + if (intermission) refdefflags |= REFDEFFLAG_INTERMISSION; + V_CalcRefdef(this, refdefflags); // TODO? uses .health stat in the engine when this isn't called here, may be broken! + return; + } + vector vieworg = this.origin; if(intermission) { diff --git a/qcsrc/lib/csqcmodel/cl_player.qh b/qcsrc/lib/csqcmodel/cl_player.qh index 925c9bd07..ff12a662c 100644 --- a/qcsrc/lib/csqcmodel/cl_player.qh +++ b/qcsrc/lib/csqcmodel/cl_player.qh @@ -29,6 +29,8 @@ const int CSQCPLAYERSTATUS_UNPREDICTED = 0; const int CSQCPLAYERSTATUS_FROMSERVER = 1; const int CSQCPLAYERSTATUS_PREDICTED = 2; +bool use_engine_refdef; // debug option for testing legacy engine code + // only ever READ these! .int pmove_flags; const int PMF_JUMP_HELD = 1; -- 2.39.2