Several Changes

- Removed password from commandline as no longer required
- Render usable / carryable objects in off-hand
- Moved the "Use Item" to the off-hand thumbstick
- Move the show scoreboard to the Y button
- First Person Body (bit janky) can be scaled in menu, set to 0 to hide altogether
This commit is contained in:
Simon 2022-02-23 23:37:10 +00:00
parent 3408a9cd1b
commit 4a93b7c591
9 changed files with 134 additions and 32 deletions

View File

@ -1 +1 @@
+set fs_basepath /sdcard/ioquake3Quest/ +set fs_game baseq3 +set fs_basegame baseq3 +password drbeef
+set fs_basepath /sdcard/ioquake3Quest/ +set fs_game baseq3 +set fs_basegame baseq3

View File

@ -1428,9 +1428,8 @@ static void CG_DrawHoldableItem( void ) {
value = cg.snap->ps.stats[STAT_HOLDABLE_ITEM];
if ( value ) {
CG_RegisterItemVisuals( value );
CG_DrawPic( 640-ICON_SIZE, (SCREEN_HEIGHT-ICON_SIZE)/2, ICON_SIZE, ICON_SIZE, cg_items[ value ].icon );
//CG_DrawPic( 640-ICON_SIZE, (SCREEN_HEIGHT-ICON_SIZE)/2, ICON_SIZE, ICON_SIZE, cg_items[ value ].icon );
}
}
#endif // MISSIONPACK

View File

@ -83,7 +83,7 @@ void CG_AdjustFrom640( float *x, float *y, float *w, float *h ) {
}
*x += (cg.refdef.width - (640 * screenXScale)) / 2.0f + xoffset;
*y += (cg.refdef.height - (480 * screenYScale)) / 2.0f;
*y += (cg.refdef.height - (480 * screenYScale)) / 2.0f + trap_Cvar_VariableValue( "vr_hudYOffset" );
}
}

View File

@ -1206,6 +1206,10 @@ extern vmCvar_t cg_recordSPDemoName;
extern vmCvar_t cg_obeliskRespawnDelay;
#endif
void CG_TrailItem( centity_t *cent, qhandle_t hModel, vec3_t offset, float scale );
//
// cg_main.c
//

View File

@ -149,6 +149,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;
@ -274,6 +275,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", 0 },
{ &cg_thirdPerson, "cg_thirdPerson", "0", 0 },
{ &cg_teamChatTime, "cg_teamChatTime", "3000", CVAR_ARCHIVE },
{ &cg_teamChatHeight, "cg_teamChatHeight", "0", CVAR_ARCHIVE },

View File

@ -25,7 +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",
@ -1659,22 +1659,32 @@ void CG_CalculateVROffHandPosition( vec3_t origin, vec3_t angles )
CG_TrailItem
===============
*/
static void CG_TrailItem( centity_t *cent, qhandle_t hModel ) {
void CG_TrailItem( centity_t *cent, qhandle_t hModel, vec3_t offset, float scale ) {
refEntity_t ent;
vec3_t angles;
vec3_t axis[3];
if (!cent)
{
return;
}
memset(&ent, 0, sizeof(ent));
if (cent->currentState.clientNum == vr->clientNum)
{
CG_CalculateVROffHandPosition(ent.origin, angles);
AnglesToAxis(angles, ent.axis);
VectorScale( ent.axis[0], scale, ent.axis[0] );
VectorScale( ent.axis[1], scale, ent.axis[1] );
VectorScale( ent.axis[2], scale, ent.axis[2] );
vec3_t forward;
AngleVectors( angles, forward, NULL, NULL );
VectorMA( ent.origin, -16, forward, ent.origin );
vec3_t forward, right, up;
AngleVectors( angles, forward, right, up );
VectorMA( ent.origin, offset[0], right, ent.origin );
VectorMA( ent.origin, offset[1], forward, ent.origin );
VectorMA( ent.origin, offset[2], up, ent.origin );
ent.nonNormalizedAxes = qtrue;
} else {
VectorCopy(cent->lerpAngles, angles);
angles[PITCH] = 0;
@ -1890,6 +1900,19 @@ static void CG_PlayerPowerups( centity_t *cent, refEntity_t *torso ) {
int powerups;
clientInfo_t *ci;
//Player held items should render in the off-hand
if ( cent->currentState.number == cg.snap->ps.clientNum && !cg.renderingThirdPerson )
{
int value;
value = cg.snap->ps.stats[STAT_HOLDABLE_ITEM];
if ( value ) {
CG_RegisterItemVisuals( value );
vec3_t offset;
VectorSet(offset, 0, 0, -8);
CG_TrailItem( cent, cg_items[ value ].models[0], offset, 0.5f );
}
}
powerups = cent->currentState.powerups;
if ( !powerups ) {
return;
@ -1912,7 +1935,9 @@ static void CG_PlayerPowerups( centity_t *cent, refEntity_t *torso ) {
CG_PlayerFlag( cent, cgs.media.redFlagFlapSkin, torso );
}
else {
CG_TrailItem( cent, cgs.media.redFlagModel );
vec3_t offset;
VectorSet(offset, 0, -16, 0);
CG_TrailItem( cent, cgs.media.redFlagModel, offset, 1.0f );
}
trap_R_AddLightToScene( cent->lerpOrigin, 200 + (rand()&31), 1.0, 0.2f, 0.2f );
}
@ -1923,7 +1948,9 @@ static void CG_PlayerPowerups( centity_t *cent, refEntity_t *torso ) {
CG_PlayerFlag( cent, cgs.media.blueFlagFlapSkin, torso );
}
else {
CG_TrailItem( cent, cgs.media.blueFlagModel );
vec3_t offset;
VectorSet(offset, 0, -16, 0);
CG_TrailItem( cent, cgs.media.blueFlagModel, offset, 1.0f );
}
trap_R_AddLightToScene( cent->lerpOrigin, 200 + (rand()&31), 0.2f, 0.2f, 1.0 );
}
@ -1934,7 +1961,9 @@ static void CG_PlayerPowerups( centity_t *cent, refEntity_t *torso ) {
CG_PlayerFlag( cent, cgs.media.neutralFlagFlapSkin, torso );
}
else {
CG_TrailItem( cent, cgs.media.neutralFlagModel );
vec3_t offset;
VectorSet(offset, 0, -16, 0);
CG_TrailItem( cent, cgs.media.neutralFlagModel, offset, 1.0f );
}
trap_R_AddLightToScene( cent->lerpOrigin, 200 + (rand()&31), 1.0, 1.0, 1.0 );
}
@ -2320,10 +2349,16 @@ void CG_Player( centity_t *cent ) {
}
// get the player model information
qboolean firstPersonBody = (!cg.renderingThirdPerson) &&
(cg_firstPersonBodyScale.value > 0.0f) &&
( cgs.gametype != GT_SINGLE_PLAYER );
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 ||
cgs.gametype == GT_SINGLE_PLAYER) {
renderfx = RF_THIRD_PERSON; // only draw in mirrors
}
} else {
if (cg_cameraMode.integer) {
return;
@ -2337,7 +2372,24 @@ 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,
@ -2393,7 +2445,7 @@ void CG_Player( centity_t *cent ) {
VectorCopy( cent->lerpOrigin, torso.lightingOrigin );
CG_PositionRotatedEntityOnTag( &torso, &legs, ci->legsModel, "tag_torso");
CG_PositionRotatedEntityOnTag(&torso, &legs, ci->legsModel, "tag_torso");
torso.shadowPlane = shadowPlane;
torso.renderfx = renderfx;
@ -2619,12 +2671,15 @@ void CG_Player( centity_t *cent ) {
VectorCopy( cent->lerpOrigin, head.lightingOrigin );
CG_PositionRotatedEntityOnTag( &head, &torso, ci->torsoModel, "tag_head");
CG_PositionRotatedEntityOnTag(&head, &torso, ci->torsoModel, "tag_head");
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);
@ -2635,7 +2690,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

@ -52,9 +52,11 @@ VR OPTIONS MENU
#define ID_SCOPE 137
#define ID_DRAWHUD 138
#define ID_ROLLHIT 139
#define ID_GORE 140
#define ID_HUDYOFFSET 140
#define ID_BODYSCALE 141
#define ID_GORE 142
#define ID_BACK 141
#define ID_BACK 143
#define NUM_HUDDEPTH 6
#define NUM_DIRECTIONMODE 2
@ -82,6 +84,8 @@ typedef struct {
menuradiobutton_s twohanded;
menuradiobutton_s scope;
menuradiobutton_s rollhit;
menuslider_s hudyoffset;
menuslider_s bodyscale;
menulist_s gore;
menubitmap_s back;
@ -119,6 +123,8 @@ static void VR_SetMenuItems( void ) {
s_VR.twohanded.curvalue = trap_Cvar_VariableValue( "vr_twoHandedWeapons" ) != 0;
s_VR.scope.curvalue = trap_Cvar_VariableValue( "vr_weaponScope" ) != 0;
s_VR.rollhit.curvalue = trap_Cvar_VariableValue( "vr_rollWhenHit" ) != 0;
s_VR.hudyoffset.curvalue = trap_Cvar_VariableValue( "vr_hudYOffset" ) + 200;
s_VR.bodyscale.curvalue = trap_Cvar_VariableValue( "cg_firstPersonBodyScale" );
//GORE
{
@ -205,6 +211,14 @@ static void VR_Event( void* ptr, int notification ) {
trap_Cvar_SetValue( "vr_rollWhenHit", s_VR.rollhit.curvalue );
break;
case ID_HUDYOFFSET:
trap_Cvar_SetValue( "vr_hudYOffset", s_VR.hudyoffset.curvalue - 200);
break;
case ID_BODYSCALE:
trap_Cvar_SetValue( "cg_firstPersonBodyScale", s_VR.bodyscale.curvalue);
break;
case ID_GORE: {
switch ((int)s_VR.gore.curvalue) {
case 0:
@ -444,11 +458,32 @@ static void VR_MenuInit( void ) {
s_VR.rollhit.generic.x = VR_X_POS;
s_VR.rollhit.generic.y = y;
y += BIGCHAR_HEIGHT;
s_VR.hudyoffset.generic.type = MTYPE_SLIDER;
s_VR.hudyoffset.generic.x = VR_X_POS;
s_VR.hudyoffset.generic.y = y;
s_VR.hudyoffset.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
s_VR.hudyoffset.generic.name = "HUD Y Offset:";
s_VR.hudyoffset.generic.id = ID_HUDYOFFSET;
s_VR.hudyoffset.generic.callback = VR_Event;
s_VR.hudyoffset.minvalue = 0;
s_VR.hudyoffset.maxvalue = 400;
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;
s_VR.gore.generic.x = VR_X_POS;
s_VR.gore.generic.x = VR_X_POS - 120;
s_VR.gore.generic.y = y;
s_VR.gore.generic.name = "Gore:";
s_VR.gore.generic.callback = VR_Event;
@ -482,6 +517,9 @@ static void VR_MenuInit( void ) {
Menu_AddItem( &s_VR.menu, &s_VR.heightadjust );
Menu_AddItem( &s_VR.menu, &s_VR.twohanded );
Menu_AddItem( &s_VR.menu, &s_VR.scope );
Menu_AddItem( &s_VR.menu, &s_VR.rollhit );
Menu_AddItem( &s_VR.menu, &s_VR.hudyoffset );
Menu_AddItem( &s_VR.menu, &s_VR.bodyscale );
Menu_AddItem( &s_VR.menu, &s_VR.gore );
Menu_AddItem( &s_VR.menu, &s_VR.back );

View File

@ -31,6 +31,7 @@ cvar_t *vr_refreshrate = NULL;
cvar_t *vr_weaponScope = NULL;
cvar_t *vr_jumpTrigger = NULL;
cvar_t *vr_rollWhenHit = NULL;
cvar_t *vr_hudYOffset = NULL;
engine_t* VR_Init( ovrJava java )
{
@ -63,6 +64,7 @@ void VR_InitCvars( void )
vr_weaponScope = Cvar_Get ("vr_weaponScope", "1", CVAR_ARCHIVE);
vr_jumpTrigger = Cvar_Get ("vr_jumpTrigger", "1", CVAR_ARCHIVE);
vr_rollWhenHit = Cvar_Get ("vr_rollWhenHit", "0", CVAR_ARCHIVE);
vr_hudYOffset = Cvar_Get ("vr_hudYOffset", "0", CVAR_ARCHIVE);
// Values are: scale,right,up,forward,pitch,yaw,roll
// VALUES PROVIDED BY SkillFur - Thank-you!

View File

@ -458,7 +458,7 @@ static void IN_VRButtonsChanged( qboolean isRightController, uint32_t buttons )
}
if (isRightController) {
if (vr_righthanded->integer) {
if (vr_righthanded->integer == 0) {
//Right thumbstick is "use item"
if ((buttons & ovrButton_RThumb) && !(controller->buttons & ovrButton_RThumb)) {
Com_QueueEvent(in_vrEventTime, SE_KEY, K_ENTER, qtrue, 0, NULL);
@ -467,20 +467,20 @@ static void IN_VRButtonsChanged( qboolean isRightController, uint32_t buttons )
}
}
else {
//right thumbstick is scoreboard
//Right thumbstick is nothing
if ((buttons & ovrButton_RThumb) && !(controller->buttons & ovrButton_RThumb)) {
sendButtonActionSimple("+scores");
//
} else if (!(buttons & ovrButton_RThumb) && (controller->buttons & ovrButton_RThumb)) {
sendButtonActionSimple("-scores");
//
}
}
} else {
if (vr_righthanded->integer) {
if (vr_righthanded->integer == 0) {
//left thumbstick is scoreboard
if ((buttons & ovrButton_LThumb) && !(controller->buttons & ovrButton_LThumb)) {
sendButtonActionSimple("+scores");
//
} else if (!(buttons & ovrButton_LThumb) && (controller->buttons & ovrButton_LThumb)) {
sendButtonActionSimple("-scores");
//
}
} else {
//left thumbstick is "use item"
@ -499,12 +499,12 @@ static void IN_VRButtonsChanged( qboolean isRightController, uint32_t buttons )
sendButtonActionSimple("-button3");
}
// Y button - unassigned right now
// Y button - show scoreboard (and trigger realign just in case)
if ((buttons & ovrButton_Y) && !(controller->buttons & ovrButton_Y)) {
//Actually want this to reset the player location
//jni_showkeyboard();
sendButtonActionSimple("+scores");
vr.realign = 4;
} else if (!(buttons & ovrButton_Y) && (controller->buttons & ovrButton_Y)) {
sendButtonActionSimple("-scores");
}
controller->buttons = buttons;