From: divverent Date: Mon, 9 Jan 2012 12:17:11 +0000 (+0000) Subject: DP_CSQC_V_CALCREFDEF_WIP2 X-Git-Tag: xonotic-v0.8.0~96^2~376 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=b4223996191ebdbd41cee2a878cc22e1ba755514;p=xonotic%2Fdarkplaces.git DP_CSQC_V_CALCREFDEF_WIP2 git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11637 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/client.h b/client.h index 45964700..a40c2b1f 100644 --- 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); diff --git a/clvm_cmds.c b/clvm_cmds.c index a0cb9468..5809bd07 100644 --- a/clvm_cmds.c +++ b/clvm_cmds.c @@ -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); diff --git a/dpdefs/csprogsdefs.qc b/dpdefs/csprogsdefs.qc index 189a9a96..623fb01c 100644 --- a/dpdefs/csprogsdefs.qc +++ b/dpdefs/csprogsdefs.qc @@ -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; diff --git a/svvm_cmds.c b/svvm_cmds.c index f899b295..30139d3e 100644 --- a/svvm_cmds.c +++ b/svvm_cmds.c @@ -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 d1c738cc..1d94fb74 100644 --- 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 {