Restored 1st person body (it was being used!)

ensure barrel is drawn on weapons that have a barrel in the weapon selector
This commit is contained in:
Simon 2022-03-06 19:30:02 +00:00
parent 1865656379
commit c69d43461a
4 changed files with 68 additions and 7 deletions

View file

@ -151,6 +151,7 @@ vmCvar_t cg_ignore;
vmCvar_t cg_simpleItems;
vmCvar_t cg_fov;
vmCvar_t cg_zoomFov;
vmCvar_t cg_firstPersonBodyScale;
vmCvar_t cg_thirdPerson;
vmCvar_t cg_thirdPersonRange;
vmCvar_t cg_thirdPersonAngle;
@ -278,6 +279,7 @@ static cvarTable_t cvarTable[] = {
{ &cg_tracerLength, "cg_tracerlength", "100", CVAR_CHEAT },
{ &cg_thirdPersonRange, "cg_thirdPersonRange", "40", CVAR_CHEAT },
{ &cg_thirdPersonAngle, "cg_thirdPersonAngle", "0", CVAR_CHEAT },
{ &cg_firstPersonBodyScale, "cg_firstPersonBodyScale", "0", CVAR_ARCHIVE },
{ &cg_thirdPerson, "cg_thirdPerson", "0", 0 },
{ &cg_teamChatTime, "cg_teamChatTime", "3000", CVAR_ARCHIVE },
{ &cg_teamChatHeight, "cg_teamChatHeight", "0", CVAR_ARCHIVE },

View file

@ -25,6 +25,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "../vr/vr_clientinfo.h"
extern vr_clientinfo_t* vr;
extern vmCvar_t cg_firstPersonBodyScale;
char *cg_customSoundNames[MAX_CUSTOM_SOUNDS] = {
"*death1.wav",
@ -2366,10 +2367,17 @@ void CG_Player( centity_t *cent ) {
}
// get the player model information
qboolean firstPersonBody = ( cent->currentState.number == cg.snap->ps.clientNum) &&
(!cg.renderingThirdPerson) &&
(cg_firstPersonBodyScale.value > 0.0f);
renderfx = 0;
if ( cent->currentState.number == cg.snap->ps.clientNum) {
if (!cg.renderingThirdPerson) {
renderfx = RF_THIRD_PERSON; // only draw in mirrors
if (cg_firstPersonBodyScale.value == 0)
{
renderfx = RF_THIRD_PERSON; // only draw in mirrors
}
} else {
if (cg_cameraMode.integer) {
return;
@ -2383,7 +2391,25 @@ void CG_Player( centity_t *cent ) {
memset( &head, 0, sizeof(head) );
// get the rotation information
CG_PlayerAngles(cent, legs.axis, torso.axis, head.axis);
if (firstPersonBody)
{
vec3_t angles;
VectorClear(angles);
angles[YAW] = cg.refdefViewAngles[YAW] + vr->hmdorientation[YAW] - vr->weaponangles[YAW];
AnglesToAxis(angles, legs.axis);
VectorScale( legs.axis[0], cg_firstPersonBodyScale.value, legs.axis[0] );
VectorScale( legs.axis[1], cg_firstPersonBodyScale.value, legs.axis[1] );
VectorScale( legs.axis[2], cg_firstPersonBodyScale.value, legs.axis[2] );
AnglesToAxis(vec3_origin, torso.axis);
VectorScale( torso.axis[0], cg_firstPersonBodyScale.value, torso.axis[0] );
VectorScale( torso.axis[1], cg_firstPersonBodyScale.value, torso.axis[1] );
VectorScale( torso.axis[2], cg_firstPersonBodyScale.value, torso.axis[2] );
//Don't care about head
}
else
{
CG_PlayerAngles(cent, legs.axis, torso.axis, head.axis);
}
// get the animation state (after rotation, to allow feet shuffle)
CG_PlayerAnimation( cent, &legs.oldframe, &legs.frame, &legs.backlerp,
@ -2670,7 +2696,10 @@ void CG_Player( centity_t *cent ) {
head.shadowPlane = shadowPlane;
head.renderfx = renderfx;
CG_AddRefEntityWithPowerups(&head, &cent->currentState, ci->team);
if (!firstPersonBody)
{
CG_AddRefEntityWithPowerups(&head, &cent->currentState, ci->team);
}
#ifdef MISSIONPACK
CG_BreathPuffs(cent, &head);
@ -2681,7 +2710,9 @@ void CG_Player( centity_t *cent ) {
//
// add the gun / barrel / flash
//
CG_AddPlayerWeapon(&torso, NULL, cent, ci->team);
if (!firstPersonBody) {
CG_AddPlayerWeapon(&torso, NULL, cent, ci->team);
}
// add powerups floating behind the player
CG_PlayerPowerups( cent, &torso );

View file

@ -2124,6 +2124,15 @@ void CG_DrawHolsteredWeapons( void )
ent.hModel = cg_weapons[weapons[w]].weaponModel;
trap_R_AddRefEntityToScene(&ent);
if ( cg_weapons[weapons[w]].barrelModel ) {
refEntity_t barrel;
memset( &barrel, 0, sizeof( barrel ) );
barrel.hModel = cg_weapons[weapons[w]].barrelModel;
AnglesToAxis( vec3_origin, barrel.axis );
CG_PositionRotatedEntityOnTag( &barrel, &ent, cg_weapons[weapons[w]].weaponModel, "tag_barrel" );
trap_R_AddRefEntityToScene(&barrel);
}
}
else
{

View file

@ -57,8 +57,9 @@ VR OPTIONS MENU
#define ID_GORE 143
#define ID_HAPTICINTENSITY 144
#define ID_HOLSTER2D 145
#define ID_BODYSCALE 146
#define ID_BACK 146
#define ID_BACK 147
#define NUM_HUDDEPTH 6
#define NUM_DIRECTIONMODE 2
@ -90,6 +91,7 @@ typedef struct {
menuradiobutton_s lasersight;
menuslider_s hapticintensity;
menuradiobutton_s holster2d;
menuslider_s bodyscale;
menulist_s gore;
menubitmap_s back;
@ -131,6 +133,7 @@ static void VR_SetMenuItems( void ) {
s_VR.lasersight.curvalue = trap_Cvar_VariableValue( "vr_lasersight" ) != 0;
s_VR.hapticintensity.curvalue = trap_Cvar_VariableValue( "vr_hapticIntensity" );
s_VR.holster2d.curvalue = trap_Cvar_VariableValue( "cg_holsterSimple2DIcons" ) != 0;
s_VR.bodyscale.curvalue = trap_Cvar_VariableValue( "cg_firstPersonBodyScale" );
//GORE
{
@ -231,7 +234,11 @@ static void VR_Event( void* ptr, int notification ) {
case ID_HOLSTER2D:
trap_Cvar_SetValue( "cg_holsterSimple2DIcons", s_VR.holster2d.curvalue);
break;
break;
case ID_BODYSCALE:
trap_Cvar_SetValue( "cg_firstPersonBodyScale", s_VR.bodyscale.curvalue);
break;
case ID_GORE: {
switch ((int)s_VR.gore.curvalue) {
@ -343,7 +350,7 @@ static void VR_MenuInit( void ) {
s_VR.framer.width = 256;
s_VR.framer.height = 334;
y = 100;
y = 84;
s_VR.drawhud.generic.type = MTYPE_RADIOBUTTON;
s_VR.drawhud.generic.name = "Draw HUD:";
s_VR.drawhud.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
@ -512,6 +519,17 @@ static void VR_MenuInit( void ) {
s_VR.holster2d.generic.x = VR_X_POS;
s_VR.holster2d.generic.y = y;
y += BIGCHAR_HEIGHT;
s_VR.bodyscale.generic.type = MTYPE_SLIDER;
s_VR.bodyscale.generic.name = "1st-Person Body Scale:";
s_VR.bodyscale.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
s_VR.bodyscale.generic.callback = VR_Event;
s_VR.bodyscale.generic.id = ID_BODYSCALE;
s_VR.bodyscale.generic.x = VR_X_POS;
s_VR.bodyscale.generic.y = y;
s_VR.bodyscale.minvalue = 0.0f;
s_VR.bodyscale.maxvalue = 1.0f;
y += BIGCHAR_HEIGHT + 10;
s_VR.gore.generic.type = MTYPE_SPINCONTROL;
s_VR.gore.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
@ -554,6 +572,7 @@ static void VR_MenuInit( void ) {
Menu_AddItem( &s_VR.menu, &s_VR.lasersight );
Menu_AddItem( &s_VR.menu, &s_VR.holster2d );
Menu_AddItem( &s_VR.menu, &s_VR.hapticintensity );
Menu_AddItem( &s_VR.menu, &s_VR.bodyscale );
Menu_AddItem( &s_VR.menu, &s_VR.gore );
Menu_AddItem( &s_VR.menu, &s_VR.back );