]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
DP_CSQC_V_CALCREFDEF_WIP2
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 9 Jan 2012 12:17:11 +0000 (12:17 +0000)
committerRudolf Polzer <divverent@alientrap.org>
Mon, 9 Jan 2012 12:29:00 +0000 (13:29 +0100)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11637 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=b4223996191ebdbd41cee2a878cc22e1ba755514

client.h
clvm_cmds.c
dpdefs/csprogsdefs.qc
svvm_cmds.c
view.c

index 45964700ce7532b71f18522874ebc86ddebe44b2..a40c2b1f697d352a904d9a1a1a0640c9c37fb26e 100644 (file)
--- a/client.h
+++ b/client.h
@@ -1889,7 +1889,7 @@ void SCR_CaptureVideo_SoundFrame(const portable_sampleframe_t *paintbuffer, size
 void V_DriftPitch(void);
 void V_FadeViewFlashs(void);
 void V_CalcViewBlend(void);
-void V_CalcRefdefUsing (const matrix4x4_t *entrendermatrix, const vec3_t clviewangles, qboolean teleported, qboolean clonground, qboolean clcmdjump, float clstatsviewheight);
+void V_CalcRefdefUsing (const matrix4x4_t *entrendermatrix, const vec3_t clviewangles, qboolean teleported, qboolean clonground, qboolean clcmdjump, float clstatsviewheight, qboolean cldead, qboolean clintermission);
 void V_CalcRefdef(void);
 void CL_Locs_Reload_f(void);
 
index a0cb94688e374d0e9e169a14687128d1d8d82220..5809bd07a1ae8b0fb44ada038fc1941740e367d5 100644 (file)
@@ -4150,6 +4150,8 @@ static void VM_CL_loadcubemap(prvm_prog_t *prog)
 
 #define REFDEFFLAG_TELEPORTED 1
 #define REFDEFFLAG_JUMPING 2
+#define REFDEFFLAG_DEAD 4
+#define REFDEFFLAG_INTERMISSION 8
 static void VM_CL_V_CalcRefdef(prvm_prog_t *prog)
 {
        matrix4x4_t entrendermatrix;
@@ -4157,6 +4159,8 @@ static void VM_CL_V_CalcRefdef(prvm_prog_t *prog)
        qboolean teleported;
        qboolean clonground;
        qboolean clcmdjump;
+       qboolean cldead;
+       qboolean clintermission;
        float clstatsviewheight;
        prvm_edict_t *ent;
        int flags;
@@ -4173,8 +4177,10 @@ static void VM_CL_V_CalcRefdef(prvm_prog_t *prog)
        clonground = ((int)PRVM_clientedictfloat(ent, pmove_flags) & PMF_ONGROUND) != 0;
        clcmdjump = (flags & REFDEFFLAG_JUMPING) != 0;
        clstatsviewheight = PRVM_clientedictvector(ent, view_ofs)[2];
+       cldead = (flags & REFDEFFLAG_DEAD) != 0;
+       clintermission = (flags & REFDEFFLAG_INTERMISSION) != 0;
 
-       V_CalcRefdefUsing(&entrendermatrix, clviewangles, teleported, clonground, clcmdjump, clstatsviewheight);
+       V_CalcRefdefUsing(&entrendermatrix, clviewangles, teleported, clonground, clcmdjump, clstatsviewheight, cldead, clintermission);
 
        VectorCopy(cl.csqc_vieworiginfromengine, cl.csqc_vieworigin);
        VectorCopy(cl.csqc_viewanglesfromengine, cl.csqc_viewangles);
index 189a9a96b4e05b42107473897d01db2659fbabe5..623fb01c781a6db13f031fb69c6a16dcb3c307e4 100644 (file)
@@ -910,6 +910,7 @@ const float VF_MINFPS_QUALITY   = 401;
 //1 should lead to an unmodified view
 
 //DP_CSQC_V_CALCREFDEF_WIP1
+//DP_CSQC_V_CALCREFDEF_WIP2
 //idea: divVerent
 //darkplaces implementation: divVerent
 //builtin definitions:
@@ -919,9 +920,13 @@ float PMF_DUCKED = 4;
 float PMF_ONGROUND = 8;
 float REFDEFFLAG_TELEPORTED = 1;
 float REFDEFFLAG_JUMPING = 2;
+float REFDEFFLAG_DEAD = 4;
+float REFDEFFLAG_INTERMISSION = 8;
 //- use this on the player entity after performing prediction
 //- pass REFDEFFLAG_TELEPORTED if the player teleported since last frame
 //- pass REFDEFFLAG_JUMPING if jump button is pressed
+//- pass REFDEFFLAG_DEAD if dead (DP_CSQC_V_CALCREFDEF_WIP2)
+//- pass REFDEFFLAG_INTERMISSION if in intermission (DP_CSQC_V_CALCREFDEF_WIP2)
 //- the player entity needs to have origin, velocity, pmove_flags set according
 //  to prediction (the above two PMF_ flags are used in the player's pmove_flags)
 //- NOTE: to check for this, ALSO OR a check with DP_CSQC_V_CALCREFDEF to also support
@@ -1404,3 +1409,4 @@ void(float effectindex, entity own, vector org_from, vector org_to, vector dir_f
 float trace_networkentity;
 const float RF_FULLBRIGHT      = 256;
 const float RF_NOSHADOW        = 512;
+float RF_DYNAMICMODELLIGHT = 8192;
index f899b295890a60091c7fd3f567d524a03e29fe00..30139d3e4b860b5c0225445d9971388416002ab9 100644 (file)
@@ -33,6 +33,7 @@ const char *vm_sv_extensions =
 "DP_CSQC_ROTATEMOVES "
 "DP_CSQC_SETPAUSE "
 "DP_CSQC_V_CALCREFDEF_WIP1 "
+"DP_CSQC_V_CALCREFDEF_WIP2 "
 "DP_EF_ADDITIVE "
 "DP_EF_BLUE "
 "DP_EF_DOUBLESIDED "
diff --git a/view.c b/view.c
index d1c738cc24059248b26cd6846ea4728de0c936b6..1d94fb74faed77d6a7172db70de7941b229db7ba 100644 (file)
--- a/view.c
+++ b/view.c
@@ -447,7 +447,6 @@ static void highpass3_limited(vec3_t value, vec_t fracx, vec_t limitx, vec_t fra
  * Extra input:
  *   cl.bobfall_speed
  *   cl.bobfall_swing
- *   cl.intermission
  *   cl.movecmd[0].time
  *   cl.movevars_stepheight
  *   cl.movevars_timescale
@@ -458,7 +457,6 @@ static void highpass3_limited(vec3_t value, vec_t fracx, vec_t limitx, vec_t fra
  *   cl.qw_intermission_origin
  *   cl.qw_weaponkick
  *   cls.protocol
- *   cl.stats[STAT_HEALTH]
  *   cl.time
  *   cl.velocity
  *   cl.viewangles
@@ -470,7 +468,7 @@ static void highpass3_limited(vec3_t value, vec_t fracx, vec_t limitx, vec_t fra
  *   viewmodelmatrix_nobob
  *   viewmodelmatrix_withbob
  */
-void V_CalcRefdefUsing (const matrix4x4_t *entrendermatrix, const vec3_t clviewangles, qboolean teleported, qboolean clonground, qboolean clcmdjump, float clstatsviewheight)
+void V_CalcRefdefUsing (const matrix4x4_t *entrendermatrix, const vec3_t clviewangles, qboolean teleported, qboolean clonground, qboolean clcmdjump, float clstatsviewheight, qboolean cldead, qboolean clintermission)
 {
        float vieworg[3], viewangles[3], smoothtime;
        float gunorg[3], gunangles[3];
@@ -513,7 +511,7 @@ void V_CalcRefdefUsing (const matrix4x4_t *entrendermatrix, const vec3_t clviewa
        if (v_dmg_time > 0)
                v_dmg_time -= bound(0, smoothtime, 0.1);
 
-       if (cl.intermission)
+       if (clintermission)
        {
                // entity is a fixed camera, just copy the matrix
                if (cls.protocol == PROTOCOL_QUAKEWORLD)
@@ -644,7 +642,7 @@ void V_CalcRefdefUsing (const matrix4x4_t *entrendermatrix, const vec3_t clviewa
                {
                        // first person view from entity
                        // angles
-                       if (cl.stats[STAT_HEALTH] <= 0 && v_deathtilt.integer)
+                       if (cldead && v_deathtilt.integer)
                                viewangles[ROLL] = v_deathtiltangle.value;
                        VectorAdd(viewangles, cl.punchangle, viewangles);
                        viewangles[ROLL] += V_CalcRoll(cl.viewangles, cl.velocity);
@@ -655,7 +653,7 @@ void V_CalcRefdefUsing (const matrix4x4_t *entrendermatrix, const vec3_t clviewa
                        }
                        // origin
                        VectorAdd(vieworg, cl.punchvector, vieworg);
-                       if (cl.stats[STAT_HEALTH] > 0)
+                       if (!cldead)
                        {
                                double xyspeed, bob, bobfall;
                                float cycle;
@@ -873,13 +871,15 @@ void V_CalcRefdefUsing (const matrix4x4_t *entrendermatrix, const vec3_t clviewa
 void V_CalcRefdef (void)
 {
        entity_t *ent;
+       qboolean cldead;
 
        if (cls.state == ca_connected && cls.signon == SIGNONS && !cl.csqc_server2csqcentitynumber[cl.viewentity])
        {
                // ent is the view entity (visible when out of body)
                ent = &cl.entities[cl.viewentity];
 
-               V_CalcRefdefUsing(&ent->render.matrix, cl.viewangles, !ent->persistent.trail_allowed, cl.onground, cl.cmd.jump, cl.stats[STAT_VIEWHEIGHT]); // FIXME use a better way to detect teleport/warp than trail_allowed
+               cldead = (cl.stats[STAT_HEALTH] <= 0 && cl.stats[STAT_HEALTH] != -666 && cl.stats[STAT_HEALTH] != -2342);
+               V_CalcRefdefUsing(&ent->render.matrix, cl.viewangles, !ent->persistent.trail_allowed, cl.onground, cl.cmd.jump, cl.stats[STAT_VIEWHEIGHT], cldead, cl.intermission); // FIXME use a better way to detect teleport/warp than trail_allowed
        }
        else
        {