Skip to content

Commit 06fa25f

Browse files
authored
Merge pull request #897 from ReactiveDrop/fix-cam-fix
improve asw_fix_cam
2 parents a5ef94f + f894bf5 commit 06fa25f

1 file changed

Lines changed: 17 additions & 14 deletions

File tree

src/game/client/swarm/clientmode_asw.cpp

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ ConVar asw_hear_fixed("asw_hear_fixed", "0", FCVAR_NONE, "If set, hearing audio
8080

8181
Vector g_asw_vec_fixed_cam(-276.03076, -530.74951, -196.65625);
8282
QAngle g_asw_ang_fixed_cam(42.610226, 90.289375, 0);
83+
extern ConVar sensitivity;
84+
ConVar asw_fix_cam( "asw_fix_cam", "-1", FCVAR_CHEAT, "Set to 1 to fix the camera in place." );
85+
ConVar asw_fix_cam_speed_fast( "asw_fix_cam_speed_fast", "300", FCVAR_NONE, "Speed of camera in fix cam." );
86+
ConVar asw_fix_cam_speed_slow( "asw_fix_cam_speed_slow", "100", FCVAR_NONE, "Speed of camera in fix cam while holding shift." );
87+
8388
extern ConVar asw_vehicle_cam_height;
8489
extern ConVar asw_vehicle_cam_pitch;
8590
extern ConVar asw_vehicle_cam_dist;
@@ -479,31 +484,31 @@ void ASW_Handle_Fixed_Input( bool active )
479484
float u = 0.0f;
480485

481486
bool shiftdown = vgui::input()->IsKeyDown( KEY_LSHIFT ) || vgui::input()->IsKeyDown( KEY_RSHIFT );
482-
float movespeed = shiftdown ? 40.0f : 400.0f;
487+
float movespeed = shiftdown ? asw_fix_cam_speed_slow.GetFloat() : asw_fix_cam_speed_fast.GetFloat();
483488

484489
if ( vgui::input()->IsKeyDown( KEY_W ) )
485490
{
486-
f = movespeed * gpGlobals->frametime;
491+
f = movespeed * 0.015f;
487492
}
488493
if ( vgui::input()->IsKeyDown( KEY_S ) )
489494
{
490-
f = -movespeed * gpGlobals->frametime;
495+
f = -movespeed * 0.015f;
491496
}
492497
if ( vgui::input()->IsKeyDown( KEY_A ) )
493498
{
494-
s = -movespeed * gpGlobals->frametime;
499+
s = -movespeed * 0.015f;
495500
}
496501
if ( vgui::input()->IsKeyDown( KEY_D ) )
497502
{
498-
s = movespeed * gpGlobals->frametime;
503+
s = movespeed * 0.015f;
499504
}
500505
if ( vgui::input()->IsKeyDown( KEY_X ) )
501506
{
502-
u = movespeed * gpGlobals->frametime;
507+
u = movespeed * 0.015f;
503508
}
504509
if ( vgui::input()->IsKeyDown( KEY_Z ) )
505510
{
506-
u = -movespeed * gpGlobals->frametime;
511+
u = -movespeed * 0.015f;
507512
}
508513

509514
int mx, my;
@@ -518,15 +523,15 @@ void ASW_Handle_Fixed_Input( bool active )
518523

519524
// Convert to pitch/yaw
520525

521-
float pitch = (float)dy * 0.22f;
522-
float yaw = -(float)dx * 0.22;
526+
float pitch = clamp( (float)dy, -500.0f, 500.0f );
527+
float yaw = clamp( -(float)dx, -500.0f, 500.0f );
523528

524529
// Apply mouse
525-
g_asw_ang_fixed_cam.x += pitch;
530+
g_asw_ang_fixed_cam.x += pitch * sensitivity.GetFloat() / 1000.0f;
526531

527532
g_asw_ang_fixed_cam.x = clamp( g_asw_ang_fixed_cam.x, -89.0f, 89.0f );
528533

529-
g_asw_ang_fixed_cam.y += yaw;
534+
g_asw_ang_fixed_cam.y += yaw * sensitivity.GetFloat() / 1000.0f;
530535
if ( g_asw_ang_fixed_cam.y > 180.0f )
531536
{
532537
g_asw_ang_fixed_cam.y -= 360.0f;
@@ -559,8 +564,6 @@ void ASW_Handle_Fixed_Input( bool active )
559564
s_bFixedInputActive = active;
560565
}
561566

562-
ConVar asw_fix_cam( "asw_fix_cam", "-1", FCVAR_CHEAT, "Set to 1 to fix the camera in place." );
563-
564567
void ClientModeASW::OverrideView( CViewSetup *pSetup )
565568
{
566569
QAngle camAngles;
@@ -609,7 +612,7 @@ void ClientModeASW::OverrideView( CViewSetup *pSetup )
609612
pSetup->origin = g_asw_vec_fixed_cam;
610613
pSetup->angles = g_asw_ang_fixed_cam;
611614

612-
ASW_Handle_Fixed_Input( vgui::input()->IsKeyDown( KEY_LSHIFT ) && vgui::input()->IsMouseDown( MOUSE_LEFT ) );
615+
ASW_Handle_Fixed_Input( !vgui::input()->IsMouseDown( MOUSE_LEFT ) );
613616
}
614617
}
615618

0 commit comments

Comments
 (0)