mirror of
https://github.com/ReactionQuake3/reaction.git
synced 2025-03-10 11:22:22 +00:00
Death cam.
This commit is contained in:
parent
558345819a
commit
eaacfaa7ee
5 changed files with 63 additions and 6 deletions
|
@ -2662,6 +2662,34 @@ static void CG_DrawDamageBlend()
|
||||||
CG_FillRect(cgs.screenXMin, 0, cgs.screenWidth, SCREEN_HEIGHT, damageColor);
|
CG_FillRect(cgs.screenXMin, 0, cgs.screenWidth, SCREEN_HEIGHT, damageColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=====================
|
||||||
|
CG_DrawDeathBlend
|
||||||
|
|
||||||
|
Makro: fade to black after death
|
||||||
|
=====================
|
||||||
|
*/
|
||||||
|
|
||||||
|
static void CG_DrawDeathBlend()
|
||||||
|
{
|
||||||
|
const float MAX_ALPHA = 0.875f;
|
||||||
|
float delta;
|
||||||
|
vec4_t color;
|
||||||
|
|
||||||
|
if (!cg.snap || cg.snap->ps.stats[STAT_HEALTH] > 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
delta = (cg.time - cg.timeOfDeath) / 1000.f;
|
||||||
|
VectorCopy(colorBlack, color);
|
||||||
|
color[3] = MAX_ALPHA * (1.f - 1.f / (delta + 1.f));
|
||||||
|
|
||||||
|
trap_R_SetColor(color);
|
||||||
|
trap_R_DrawStretchPic(0.f, 0.f, cg.refdef.width, cg.refdef.height, 0.f, 0.f, 1.f, 1.f, cgs.media.whiteShader);
|
||||||
|
trap_R_SetColor(NULL);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=====================
|
=====================
|
||||||
CG_DrawIRBlend
|
CG_DrawIRBlend
|
||||||
|
@ -2809,6 +2837,7 @@ void CG_DrawActive(stereoFrame_t stereoView)
|
||||||
// Elder: draw damage blend
|
// Elder: draw damage blend
|
||||||
CG_DrawDamageBlend();
|
CG_DrawDamageBlend();
|
||||||
//CG_DrawIRBlend();
|
//CG_DrawIRBlend();
|
||||||
|
CG_DrawDeathBlend();
|
||||||
|
|
||||||
// draw status bar and other floating elements
|
// draw status bar and other floating elements
|
||||||
CG_Draw2D();
|
CG_Draw2D();
|
||||||
|
|
|
@ -1339,6 +1339,8 @@ void CG_EntityEvent(centity_t * cent, vec3_t position)
|
||||||
DEBUGNAME("EV_DEATHx");
|
DEBUGNAME("EV_DEATHx");
|
||||||
trap_S_StartSound(NULL, es->number, CHAN_VOICE,
|
trap_S_StartSound(NULL, es->number, CHAN_VOICE,
|
||||||
CG_CustomSound(es->number, va("*death%i.wav", event - EV_DEATH1 + 1)));
|
CG_CustomSound(es->number, va("*death%i.wav", event - EV_DEATH1 + 1)));
|
||||||
|
if (cent->currentState.number == cg.snap->ps.clientNum)
|
||||||
|
cg.timeOfDeath = cg.time;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EV_OBITUARY:
|
case EV_OBITUARY:
|
||||||
|
|
|
@ -1189,6 +1189,9 @@ typedef struct {
|
||||||
vec3_t headPos;
|
vec3_t headPos;
|
||||||
vec3_t headAxis[3];
|
vec3_t headAxis[3];
|
||||||
vec3_t oldHeadPos;
|
vec3_t oldHeadPos;
|
||||||
|
|
||||||
|
// Makro - time of death
|
||||||
|
int timeOfDeath;
|
||||||
} cg_t;
|
} cg_t;
|
||||||
|
|
||||||
//Blaze: struct to hold the func_breakable stuff
|
//Blaze: struct to hold the func_breakable stuff
|
||||||
|
|
|
@ -2669,11 +2669,18 @@ void CG_Player(centity_t * cent)
|
||||||
//Makro - save the head pos and orientation if this is the curremt client
|
//Makro - save the head pos and orientation if this is the curremt client
|
||||||
if (cent->currentState.number == cg.clientNum)
|
if (cent->currentState.number == cg.clientNum)
|
||||||
{
|
{
|
||||||
memcpy(cg.headAxis, head.axis, sizeof(head.axis));
|
trace_t tr;
|
||||||
memcpy(cg.headPos, head.origin, sizeof(head.origin));
|
AxisCopy(head.axis, cg.headAxis);
|
||||||
|
VectorCopy(head.origin, cg.headPos);
|
||||||
cg.headPos[2] += 16;
|
cg.headPos[2] += 16;
|
||||||
|
|
||||||
|
CG_Trace(&tr, head.origin, NULL, NULL, cg.headPos, cg.clientNum, CONTENTS_SOLID);
|
||||||
|
VectorCopy(tr.endpos, cg.headPos);
|
||||||
|
|
||||||
if (cg.snap->ps.stats[STAT_HEALTH] > 0)
|
if (cg.snap->ps.stats[STAT_HEALTH] > 0)
|
||||||
memcpy(cg.oldHeadPos, cg.headPos, sizeof(cg.headPos));
|
{
|
||||||
|
VectorCopy(cg.headPos, cg.oldHeadPos);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
head.shadowPlane = shadowPlane;
|
head.shadowPlane = shadowPlane;
|
||||||
|
|
|
@ -449,12 +449,16 @@ static void CG_DeadPlayerView()
|
||||||
cg.refdefViewAngles[YAW] = cg.snap->ps.stats[STAT_DEAD_YAW];
|
cg.refdefViewAngles[YAW] = cg.snap->ps.stats[STAT_DEAD_YAW];
|
||||||
cg.refdef.vieworg[2] += cg.predictedPlayerState.viewheight;
|
cg.refdef.vieworg[2] += cg.predictedPlayerState.viewheight;
|
||||||
} else {
|
} else {
|
||||||
|
vec3_t mins = { -16, -16, -16, };
|
||||||
|
vec3_t maxs = { 16, 16, 16, };
|
||||||
|
|
||||||
trace_t tr;
|
trace_t tr;
|
||||||
|
|
||||||
memcpy(cg.refdef.vieworg, cg.headPos, sizeof(cg.headPos));
|
VectorCopy(cg.headPos, cg.refdef.vieworg);
|
||||||
memcpy(cg.refdef.viewaxis, cg.headAxis, sizeof(cg.headAxis));
|
AxisCopy(cg.headAxis, cg.refdef.viewaxis);
|
||||||
|
|
||||||
CG_Trace(&tr, cg.oldHeadPos, NULL, NULL, cg.refdef.vieworg, cg.clientNum, CONTENTS_SOLID);
|
// TODO: deal with the less fortunate cases (startsolid / allsolid)
|
||||||
|
CG_Trace(&tr, cg.oldHeadPos, mins, maxs, cg.refdef.vieworg, cg.clientNum, CONTENTS_SOLID);
|
||||||
VectorCopy(tr.endpos, cg.refdef.vieworg);
|
VectorCopy(tr.endpos, cg.refdef.vieworg);
|
||||||
VectorCopy(tr.endpos, cg.oldHeadPos);
|
VectorCopy(tr.endpos, cg.oldHeadPos);
|
||||||
}
|
}
|
||||||
|
@ -875,6 +879,18 @@ static int CG_CalcFov(void)
|
||||||
inwater = qfalse;
|
inwater = qfalse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// warp if dead
|
||||||
|
if (cg.snap->ps.stats[STAT_HEALTH] < 0)
|
||||||
|
{
|
||||||
|
const float DEATH_WAVE_AMPLITUDE = 5.f;
|
||||||
|
float delta = (cg.time - cg.timeOfDeath) / 1000.f + 1.f;
|
||||||
|
float amp = 1.f / (delta * delta);
|
||||||
|
phase = cg.time / 1000.0 * WAVE_FREQUENCY * M_PI * 2;
|
||||||
|
v = DEATH_WAVE_AMPLITUDE * sin(phase) * amp;
|
||||||
|
fov_x += v;
|
||||||
|
fov_y -= v;
|
||||||
|
}
|
||||||
|
|
||||||
// set it
|
// set it
|
||||||
cg.refdef.fov_x = fov_x;
|
cg.refdef.fov_x = fov_x;
|
||||||
cg.refdef.fov_y = fov_y;
|
cg.refdef.fov_y = fov_y;
|
||||||
|
|
Loading…
Reference in a new issue