]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Restore engine refdef support, add a global to toggle it
authorMario <mario.mario@y7mail.com>
Sun, 27 Nov 2022 06:09:36 +0000 (16:09 +1000)
committerMario <mario.mario@y7mail.com>
Sun, 27 Nov 2022 06:09:36 +0000 (16:09 +1000)
qcsrc/lib/csqcmodel/cl_player.qc
qcsrc/lib/csqcmodel/cl_player.qh

index 4331f731045ecf21e3dc4fee94c3a9a86589a950..a92fcc5c5b600294e8825dc037063f3eb949dace 100644 (file)
@@ -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)
        {
index 925c9bd07f6988024728a82a2a289fbee707fdfd..ff12a662c2251276bf691fa2fc672a7731eb3efc 100644 (file)
@@ -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;