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);
#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;
qboolean teleported;
qboolean clonground;
qboolean clcmdjump;
+ qboolean cldead;
+ qboolean clintermission;
float clstatsviewheight;
prvm_edict_t *ent;
int flags;
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);
//1 should lead to an unmodified view
//DP_CSQC_V_CALCREFDEF_WIP1
+//DP_CSQC_V_CALCREFDEF_WIP2
//idea: divVerent
//darkplaces implementation: divVerent
//builtin definitions:
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
float trace_networkentity;
const float RF_FULLBRIGHT = 256;
const float RF_NOSHADOW = 512;
+float RF_DYNAMICMODELLIGHT = 8192;
"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 "
* Extra input:
* cl.bobfall_speed
* cl.bobfall_swing
- * cl.intermission
* cl.movecmd[0].time
* cl.movevars_stepheight
* cl.movevars_timescale
* cl.qw_intermission_origin
* cl.qw_weaponkick
* cls.protocol
- * cl.stats[STAT_HEALTH]
* cl.time
* cl.velocity
* cl.viewangles
* 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];
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)
{
// 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);
}
// origin
VectorAdd(vieworg, cl.punchvector, vieworg);
- if (cl.stats[STAT_HEALTH] > 0)
+ if (!cldead)
{
double xyspeed, bob, bobfall;
float cycle;
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
{