mirror of
https://github.com/astromaddie/lambda1-vr.git
synced 2026-10-27 12:00:14 +01:00
Several Changes..
- HUD positioning - still needs a bit of tweaking - Crowbar whoosing sounds now working - Flashlight on X button - Change weapon selection using right stick up/down, press fire to select chosen weapon
This commit is contained in:
1 parent
42cf81a178
commit
0c66efa48d
8 files changed
+81
-64
No files matched your search
@@ -1148,6 +1148,11 @@ static inline sendButtonActionSimple(const char* action)
|
||||
Cbuf_AddText( command );
|
||||
}
|
||||
|
||||
static inline between(float min, float val, float max)
|
||||
{
|
||||
return (min < val) && (val < max);
|
||||
}
|
||||
|
||||
static void ovrApp_HandleInput( ovrApp * app )
|
||||
{
|
||||
//The amount of yaw changed by controller
|
||||
@@ -1312,11 +1317,19 @@ static void ovrApp_HandleInput( ovrApp * app )
|
||||
flashlightangles[YAW] += (cl.refdef.cl_viewangles[YAW] - hmdorientation[YAW]);
|
||||
controllerYawHeading = -cl.refdef.cl_viewangles[YAW] + flashlightangles[YAW];
|
||||
|
||||
//flashlight on/off
|
||||
if (((leftTrackedRemoteState_new.Buttons & ovrButton_X) !=
|
||||
(leftTrackedRemoteState_old.Buttons & ovrButton_X)) &&
|
||||
(leftTrackedRemoteState_old.Buttons & ovrButton_X)) {
|
||||
sendButtonActionSimple("impulse 100");
|
||||
}
|
||||
|
||||
//Run
|
||||
handleTrackedControllerButton(offHandTrackedRemoteState,
|
||||
offHandTrackedRemoteStateOld,
|
||||
handleTrackedControllerButton(&leftTrackedRemoteState_new,
|
||||
&leftTrackedRemoteState_old,
|
||||
ovrButton_GripTrigger, K_SHIFT);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Right-hand specific stuff
|
||||
{
|
||||
@@ -1347,23 +1360,21 @@ static void ovrApp_HandleInput( ovrApp * app )
|
||||
if (dominantGripPushed && (GetTimeInMilliSeconds() - dominantGripPushTime) > vr_reloadtimeoutms->integer)
|
||||
{
|
||||
//Fire Secondary
|
||||
handleTrackedControllerButton(&rightTrackedRemoteState_new,
|
||||
&rightTrackedRemoteState_old,
|
||||
ovrButton_Trigger, K_MOUSE2);
|
||||
if ((rightTrackedRemoteState_new.Buttons & ovrButton_Trigger) !=
|
||||
(rightTrackedRemoteState_old.Buttons & ovrButton_Trigger)) {
|
||||
|
||||
sendButtonAction("+attack2", (rightTrackedRemoteState_new.Buttons & ovrButton_Trigger));
|
||||
}
|
||||
} else {
|
||||
//Fire Primary
|
||||
handleTrackedControllerButton(&rightTrackedRemoteState_new,
|
||||
&rightTrackedRemoteState_old,
|
||||
ovrButton_Trigger, K_MOUSE1);
|
||||
if ((rightTrackedRemoteState_new.Buttons & ovrButton_Trigger) !=
|
||||
(rightTrackedRemoteState_old.Buttons & ovrButton_Trigger)) {
|
||||
|
||||
sendButtonAction("+attack", (rightTrackedRemoteState_new.Buttons & ovrButton_Trigger));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//flashlight on/off
|
||||
if ((rightTrackedRemoteState_new.Buttons & ovrButton_Trigger) &&
|
||||
((rightTrackedRemoteState_new.Buttons & ovrButton_Trigger) !=
|
||||
(rightTrackedRemoteState_old.Buttons & ovrButton_Trigger))) {
|
||||
|
||||
sendButtonActionSimple("impulse 100");
|
||||
}
|
||||
//Unused for now
|
||||
}
|
||||
|
||||
//Duck with A
|
||||
@@ -1372,6 +1383,27 @@ static void ovrApp_HandleInput( ovrApp * app )
|
||||
|
||||
sendButtonAction("+duck", (rightTrackedRemoteState_new.Buttons & ovrButton_A));
|
||||
}
|
||||
|
||||
//Weapon Chooser
|
||||
static bool weaponSwitched = false;
|
||||
if (between(-0.15f, rightTrackedRemoteState_new.Joystick.x, 0.15f) &&
|
||||
(between(0.7f, rightTrackedRemoteState_new.Joystick.y, 1.0f) ||
|
||||
between(-1.0f, rightTrackedRemoteState_new.Joystick.y, -0.7f)))
|
||||
{
|
||||
if (!weaponSwitched) {
|
||||
if (between(0.7f, rightTrackedRemoteState_new.Joystick.y, 1.0f))
|
||||
{
|
||||
sendButtonActionSimple("invnext");
|
||||
}
|
||||
else
|
||||
{
|
||||
sendButtonActionSimple("invprev");
|
||||
}
|
||||
weaponSwitched = true;
|
||||
}
|
||||
} else {
|
||||
weaponSwitched = false;
|
||||
}
|
||||
}
|
||||
|
||||
//Left-hand specific stuff
|
||||
@@ -1400,25 +1432,23 @@ static void ovrApp_HandleInput( ovrApp * app )
|
||||
remote_movementForward);
|
||||
|
||||
if (!r_lefthand->integer) {
|
||||
//flashlight on/off
|
||||
if ((leftTrackedRemoteState_new.Buttons & ovrButton_Trigger) &&
|
||||
((leftTrackedRemoteState_new.Buttons & ovrButton_Trigger) !=
|
||||
(leftTrackedRemoteState_old.Buttons & ovrButton_Trigger))) {
|
||||
|
||||
sendButtonActionSimple("impulse 100");
|
||||
}
|
||||
//Unused for now
|
||||
} else {
|
||||
if (dominantGripPushed && (GetTimeInMilliSeconds() - dominantGripPushTime) > vr_reloadtimeoutms->integer)
|
||||
{
|
||||
//Fire Secondary
|
||||
handleTrackedControllerButton(&leftTrackedRemoteState_new,
|
||||
&leftTrackedRemoteState_old,
|
||||
ovrButton_Trigger, K_MOUSE2);
|
||||
if ((leftTrackedRemoteState_new.Buttons & ovrButton_Trigger) !=
|
||||
(leftTrackedRemoteState_old.Buttons & ovrButton_Trigger)) {
|
||||
|
||||
sendButtonAction("+attack2", (leftTrackedRemoteState_new.Buttons & ovrButton_Trigger));
|
||||
}
|
||||
} else {
|
||||
//Fire Primary
|
||||
handleTrackedControllerButton(&leftTrackedRemoteState_new,
|
||||
&leftTrackedRemoteState_old,
|
||||
ovrButton_Trigger, K_MOUSE1);
|
||||
if ((leftTrackedRemoteState_new.Buttons & ovrButton_Trigger) !=
|
||||
(leftTrackedRemoteState_old.Buttons & ovrButton_Trigger)) {
|
||||
|
||||
sendButtonAction("+attack", (leftTrackedRemoteState_new.Buttons & ovrButton_Trigger));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1462,20 +1492,6 @@ static void ovrApp_HandleInput( ovrApp * app )
|
||||
{
|
||||
decreaseSnap = true;
|
||||
}
|
||||
|
||||
//Next Weapon
|
||||
if (((leftTrackedRemoteState_new.Buttons & ovrButton_X) !=
|
||||
(leftTrackedRemoteState_old.Buttons & ovrButton_X)) &&
|
||||
(leftTrackedRemoteState_old.Buttons & ovrButton_X)){
|
||||
sendButtonActionSimple("invnext");
|
||||
}
|
||||
|
||||
//Prev Weapon
|
||||
if (((leftTrackedRemoteState_new.Buttons & ovrButton_Y) !=
|
||||
(leftTrackedRemoteState_old.Buttons & ovrButton_Y)) &&
|
||||
(leftTrackedRemoteState_old.Buttons & ovrButton_Y)){
|
||||
sendButtonActionSimple("invprev");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -871,7 +871,7 @@ int CHudAmmo::Draw( float flTime )
|
||||
ScaleColors( r, g, b, a );
|
||||
|
||||
// Does this weapon have a clip?
|
||||
y = ScreenHeight - gHUD.m_iFontHeight - gHUD.m_iFontHeight / 2 - (ScreenHeight * 0.3f);
|
||||
y = ScreenHeight - gHUD.m_iFontHeight - gHUD.m_iFontHeight / 2 - (ScreenHeight / 3);
|
||||
|
||||
// Does weapon have any ammo at all?
|
||||
if( m_pWeapon->iAmmoType > 0 )
|
||||
@@ -1014,8 +1014,8 @@ int CHudAmmo::DrawWList( float flTime )
|
||||
else
|
||||
iActiveSlot = gpActiveSel->iSlot;
|
||||
|
||||
x = 10; //!!!
|
||||
y = 10; //!!!
|
||||
x = ScreenWidth / 3;
|
||||
y = ScreenHeight / 3;
|
||||
|
||||
// Ensure that there are available choices in the active slot
|
||||
if( iActiveSlot > 0 )
|
||||
@@ -1060,12 +1060,12 @@ int CHudAmmo::DrawWList( float flTime )
|
||||
}
|
||||
|
||||
a = 128; //!!!
|
||||
x = 10;
|
||||
x = ScreenWidth / 3;
|
||||
|
||||
// Draw all of the buckets
|
||||
for( i = 0; i < MAX_WEAPON_SLOTS; i++ )
|
||||
{
|
||||
y = giBucketHeight + 10;
|
||||
y = (ScreenHeight / 3) + giBucketHeight + 10;
|
||||
|
||||
// If this is the active slot, draw the bigger pictures,
|
||||
// otherwise just draw boxes
|
||||
|
||||
@@ -68,7 +68,7 @@ int CHudAmmoSecondary::Draw( float flTime )
|
||||
|
||||
AmmoWidth = gHUD.GetSpriteRect( gHUD.m_HUD_number_0 ).right - gHUD.GetSpriteRect( gHUD.m_HUD_number_0 ).left;
|
||||
|
||||
y = (ScreenHeight * 0.3f) - ( gHUD.m_iFontHeight * 4 ); // this is one font height higher than the weapon ammo values
|
||||
y = (ScreenHeight / 3) - ( gHUD.m_iFontHeight * 4 ); // this is one font height higher than the weapon ammo values
|
||||
x = (ScreenWidth * 0.65f) - AmmoWidth;
|
||||
|
||||
if( m_HUD_ammoicon )
|
||||
|
||||
@@ -130,8 +130,8 @@ int HistoryResource::DrawAmmoHistory( float flTime )
|
||||
ScaleColors( r, g, b, min( scale, 255 ) );
|
||||
|
||||
// Draw the pic
|
||||
int ypos = ScreenHeight - (AMMO_PICKUP_PICK_HEIGHT + (AMMO_PICKUP_GAP * i));
|
||||
int xpos = ScreenWidth - 24;
|
||||
int ypos = ScreenHeight - (AMMO_PICKUP_PICK_HEIGHT + (AMMO_PICKUP_GAP * i)) - (ScreenHeight / 3);
|
||||
int xpos = (ScreenWidth / 4) - 24;
|
||||
if( spr && *spr ) // weapon isn't loaded yet so just don't draw the pic
|
||||
{
|
||||
// the dll has to make sure it has sent info the weapons you need
|
||||
@@ -160,8 +160,8 @@ int HistoryResource::DrawAmmoHistory( float flTime )
|
||||
float scale = ( rgAmmoHistory[i].DisplayTime - flTime ) * 80;
|
||||
ScaleColors( r, g, b, min( scale, 255 ) );
|
||||
|
||||
int ypos = ScreenHeight - ( AMMO_PICKUP_PICK_HEIGHT + ( AMMO_PICKUP_GAP * i ) );
|
||||
int xpos = ScreenWidth - ( weap->rcInactive.right - weap->rcInactive.left );
|
||||
int ypos = ScreenHeight - ( AMMO_PICKUP_PICK_HEIGHT + ( AMMO_PICKUP_GAP * i ) ) - (ScreenHeight / 3);
|
||||
int xpos = (ScreenWidth / 4) - ( weap->rcInactive.right - weap->rcInactive.left );
|
||||
SPR_Set( weap->hInactive, r, g, b );
|
||||
SPR_DrawAdditive( 0, xpos, ypos, &weap->rcInactive );
|
||||
}
|
||||
@@ -178,8 +178,8 @@ int HistoryResource::DrawAmmoHistory( float flTime )
|
||||
float scale = ( rgAmmoHistory[i].DisplayTime - flTime ) * 80;
|
||||
ScaleColors( r, g, b, min( scale, 255 ) );
|
||||
|
||||
int ypos = ScreenHeight - ( AMMO_PICKUP_PICK_HEIGHT + ( AMMO_PICKUP_GAP * i ) );
|
||||
int xpos = ScreenWidth - ( rect.right - rect.left ) - 10;
|
||||
int ypos = ScreenHeight - ( AMMO_PICKUP_PICK_HEIGHT + ( AMMO_PICKUP_GAP * i ) ) - (ScreenHeight / 3);
|
||||
int xpos = (ScreenWidth / 4) - ( rect.right - rect.left ) - 10;
|
||||
|
||||
SPR_Set( gHUD.GetSprite( rgAmmoHistory[i].iId ), r, g, b );
|
||||
SPR_DrawAdditive( 0, xpos, ypos, &rect );
|
||||
|
||||
@@ -108,8 +108,8 @@ int CHudBattery::Draw( float flTime )
|
||||
|
||||
int iOffset = ( m_prc1->bottom - m_prc1->top ) / 6;
|
||||
|
||||
y = ScreenHeight - gHUD.m_iFontHeight - gHUD.m_iFontHeight / 2;
|
||||
x = ScreenWidth / 5;
|
||||
y = ScreenHeight - gHUD.m_iFontHeight - gHUD.m_iFontHeight / 2 - (ScreenHeight / 3);
|
||||
x = ScreenWidth / 4;
|
||||
|
||||
// make sure we have the right sprite handles
|
||||
if( !m_hSprite1 )
|
||||
|
||||
@@ -56,8 +56,8 @@ int CHudStatusIcons::Draw( float flTime )
|
||||
if( gEngfuncs.IsSpectateOnly() )
|
||||
return 1;
|
||||
// find starting position to draw from, along right-hand side of screen
|
||||
int x = 5;
|
||||
int y = ScreenHeight / 2;
|
||||
int x = ScreenWidth / 3;
|
||||
int y = ScreenHeight / 3;
|
||||
|
||||
// loop through icon list, and draw any valid icons drawing up from the middle of screen
|
||||
for( int i = 0; i < MAX_ICONSPRITES; i++ )
|
||||
|
||||
@@ -151,9 +151,10 @@ void VRHelper::UpdateGunPosition(struct ref_params_s* pparams)
|
||||
Vector originInRelativeHLSpace(-originInVRSpace.z * vr_worldscale->value, -originInVRSpace.x * vr_worldscale->value, originInVRSpace.y * vr_worldscale->value);
|
||||
|
||||
cl_entity_t *localPlayer = gEngfuncs.GetLocalPlayer();
|
||||
Vector clientGroundPosition = localPlayer->curstate.origin;
|
||||
clientGroundPosition.z -= localPlayer->curstate.mins.z;
|
||||
Vector originInHLSpace = clientGroundPosition + originInRelativeHLSpace;
|
||||
Vector clientPosition = pparams->vieworg;
|
||||
//Vector clientPositionInRelativeHLSpace(clientPosition.x * vr_worldscale->value, clientPosition.y * vr_worldscale->value, , clientPosition.z * vr_worldscale->value);
|
||||
|
||||
Vector originInHLSpace = clientPosition + originInRelativeHLSpace;
|
||||
|
||||
VectorCopy(originInHLSpace, viewent->origin);
|
||||
VectorCopy(originInHLSpace, viewent->curstate.origin);
|
||||
|
||||
@@ -160,10 +160,10 @@ void CCrowbar::ItemPostFrame()
|
||||
if (!playedWooshSound)
|
||||
{
|
||||
// prevent w-w-woo-woosh stutters when player waves crowbar around frantically
|
||||
if (UTIL_WeaponTimeBase() > lastWooshSoundTime + 0.5f)
|
||||
if (gpGlobals->time > lastWooshSoundTime + 0.5f)
|
||||
{
|
||||
EMIT_SOUND_DYN(ENT(pev), CHAN_ITEM, "weapons/cbar_miss1.wav", 1, ATTN_NORM, 0, 98 + RANDOM_LONG(0, 3));
|
||||
lastWooshSoundTime = UTIL_WeaponTimeBase();
|
||||
lastWooshSoundTime = gpGlobals->time;
|
||||
}
|
||||
playedWooshSound = true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user