mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2024-11-10 06:41:58 +00:00
Tweaks to weapon selector
and make damage roll cvar apply to pitch too
This commit is contained in:
parent
9c62edc5f8
commit
af495e03a0
2 changed files with 18 additions and 5 deletions
|
@ -381,12 +381,12 @@ static void CG_OffsetFirstPersonView( void ) {
|
||||||
ratio = cg.time - cg.damageTime;
|
ratio = cg.time - cg.damageTime;
|
||||||
if ( ratio < DAMAGE_DEFLECT_TIME ) {
|
if ( ratio < DAMAGE_DEFLECT_TIME ) {
|
||||||
ratio /= DAMAGE_DEFLECT_TIME;
|
ratio /= DAMAGE_DEFLECT_TIME;
|
||||||
angles[PITCH] += ratio * cg.v_dmg_pitch;
|
angles[PITCH] += ratio * cg.v_dmg_pitch * hitRollCoeff;
|
||||||
angles[ROLL] += ratio * cg.v_dmg_roll * hitRollCoeff;
|
angles[ROLL] += ratio * cg.v_dmg_roll * hitRollCoeff;
|
||||||
} else {
|
} else {
|
||||||
ratio = 1.0 - ( ratio - DAMAGE_DEFLECT_TIME ) / DAMAGE_RETURN_TIME;
|
ratio = 1.0 - ( ratio - DAMAGE_DEFLECT_TIME ) / DAMAGE_RETURN_TIME;
|
||||||
if ( ratio > 0 ) {
|
if ( ratio > 0 ) {
|
||||||
angles[PITCH] += ratio * cg.v_dmg_pitch;
|
angles[PITCH] += ratio * cg.v_dmg_pitch * hitRollCoeff;
|
||||||
angles[ROLL] += ratio * cg.v_dmg_roll * hitRollCoeff;
|
angles[ROLL] += ratio * cg.v_dmg_roll * hitRollCoeff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2083,7 +2083,7 @@ void CG_DrawHolsteredWeapons( void )
|
||||||
{
|
{
|
||||||
if ( cg_weapons[ weapons[w] ].item ) {
|
if ( cg_weapons[ weapons[w] ].item ) {
|
||||||
//first calculate holster slot position
|
//first calculate holster slot position
|
||||||
vec3_t angles, iconOrigin;
|
vec3_t angles, iconOrigin,iconBackground;
|
||||||
VectorClear(angles);
|
VectorClear(angles);
|
||||||
angles[YAW] = startingPositionYaw - (w * SEP) - 4; // add a few degrees as models aren't central
|
angles[YAW] = startingPositionYaw - (w * SEP) - 4; // add a few degrees as models aren't central
|
||||||
vec3_t forward;
|
vec3_t forward;
|
||||||
|
@ -2092,10 +2092,13 @@ void CG_DrawHolsteredWeapons( void )
|
||||||
int dist = (cg.time - cg.weaponHolsterTime) / 10;
|
int dist = (cg.time - cg.weaponHolsterTime) / 10;
|
||||||
if (dist > DIST) dist = DIST;
|
if (dist > DIST) dist = DIST;
|
||||||
VectorMA(vieworg, dist, forward, iconOrigin);
|
VectorMA(vieworg, dist, forward, iconOrigin);
|
||||||
|
VectorMA(vieworg, dist+0.01f, forward, iconBackground);
|
||||||
|
|
||||||
float worldscale = trap_Cvar_VariableValue("vr_worldscale");
|
float worldscale = trap_Cvar_VariableValue("vr_worldscale");
|
||||||
iconOrigin[2] -= PLAYER_HEIGHT;
|
iconOrigin[2] -= PLAYER_HEIGHT;
|
||||||
iconOrigin[2] += (vr->hmdposition[1] * 0.85f) * worldscale;
|
iconOrigin[2] += (vr->hmdposition[1] * 0.85f) * worldscale;
|
||||||
|
iconBackground[2] -= PLAYER_HEIGHT;
|
||||||
|
iconBackground[2] += (vr->hmdposition[1] * 0.85f) * worldscale;
|
||||||
|
|
||||||
//Float sprite above selected weapon
|
//Float sprite above selected weapon
|
||||||
qboolean selected = qfalse;
|
qboolean selected = qfalse;
|
||||||
|
@ -2109,7 +2112,7 @@ void CG_DrawHolsteredWeapons( void )
|
||||||
refEntity_t sprite;
|
refEntity_t sprite;
|
||||||
memset( &sprite, 0, sizeof( sprite ) );
|
memset( &sprite, 0, sizeof( sprite ) );
|
||||||
VectorCopy( iconOrigin, sprite.origin );
|
VectorCopy( iconOrigin, sprite.origin );
|
||||||
sprite.origin[2] += 2.5f + (0.5f * sinf(DEG2RAD(AngleNormalize360(cg.time/6))));
|
sprite.origin[2] += 2.5f + (0.5f * sinf(DEG2RAD(AngleNormalize360((cg.time - cg.weaponHolsterTime)/4))));
|
||||||
sprite.reType = RT_SPRITE;
|
sprite.reType = RT_SPRITE;
|
||||||
sprite.customShader = cgs.media.friendShader;
|
sprite.customShader = cgs.media.friendShader;
|
||||||
sprite.radius = 0.5f;
|
sprite.radius = 0.5f;
|
||||||
|
@ -2164,7 +2167,7 @@ void CG_DrawHolsteredWeapons( void )
|
||||||
barrel.hModel = cg_weapons[weapons[w]].barrelModel;
|
barrel.hModel = cg_weapons[weapons[w]].barrelModel;
|
||||||
vec3_t barrelAngles;
|
vec3_t barrelAngles;
|
||||||
VectorClear(barrelAngles);
|
VectorClear(barrelAngles);
|
||||||
barrelAngles[ROLL] = AngleNormalize360(cg.time * 0.9f);
|
barrelAngles[ROLL] = AngleNormalize360((cg.time - cg.weaponHolsterTime) * 0.9f);
|
||||||
AnglesToAxis(barrelAngles, barrel.axis);
|
AnglesToAxis(barrelAngles, barrel.axis);
|
||||||
CG_PositionRotatedEntityOnTag(&barrel, &ent, cg_weapons[weapons[w]].weaponModel,
|
CG_PositionRotatedEntityOnTag(&barrel, &ent, cg_weapons[weapons[w]].weaponModel,
|
||||||
"tag_barrel");
|
"tag_barrel");
|
||||||
|
@ -2185,6 +2188,16 @@ void CG_DrawHolsteredWeapons( void )
|
||||||
sprite.shaderRGBA[2] = 255;
|
sprite.shaderRGBA[2] = 255;
|
||||||
sprite.shaderRGBA[3] = 255;
|
sprite.shaderRGBA[3] = 255;
|
||||||
trap_R_AddRefEntityToScene( &sprite );
|
trap_R_AddRefEntityToScene( &sprite );
|
||||||
|
|
||||||
|
//And now the selection background
|
||||||
|
VectorCopy( iconBackground, sprite.origin );
|
||||||
|
sprite.customShader = cgs.media.selectShader;
|
||||||
|
sprite.radius = 0.7f + (selected ? 0.1f : 0);
|
||||||
|
sprite.shaderRGBA[0] = 255;
|
||||||
|
sprite.shaderRGBA[1] = 255;
|
||||||
|
sprite.shaderRGBA[2] = 255;
|
||||||
|
sprite.shaderRGBA[3] = 255;
|
||||||
|
trap_R_AddRefEntityToScene( &sprite );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue