File tree Expand file tree Collapse file tree 4 files changed +26
-2
lines changed Expand file tree Collapse file tree 4 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -69,3 +69,16 @@ CTaskSimpleUseGun* CPedIntelligenceSA::GetTaskUseGun()
69
69
70
70
return nullptr ;
71
71
}
72
+
73
+ CTaskSimpleFight* CPedIntelligenceSA::GetFightTask ()
74
+ {
75
+ CTaskManager* taskMgr = GetTaskManager ();
76
+ if (!taskMgr)
77
+ return nullptr ;
78
+
79
+ CTask* secondaryTask = taskMgr->GetTaskSecondary (TASK_SECONDARY_ATTACK);
80
+ if (secondaryTask && secondaryTask->GetTaskType () == TASK_SIMPLE_FIGHT)
81
+ return dynamic_cast <CTaskSimpleFight*>(secondaryTask);
82
+
83
+ return nullptr ;
84
+ }
Original file line number Diff line number Diff line change @@ -55,4 +55,5 @@ class CPedIntelligenceSA : public CPedIntelligence
55
55
bool TestForStealthKill (CPed* pPed, bool bUnk);
56
56
CTaskSAInterface* SetTaskDuckSecondary (unsigned short nLengthOfDuck);
57
57
CTaskSimpleUseGun* GetTaskUseGun ();
58
+ CTaskSimpleFight* GetFightTask ();
58
59
};
Original file line number Diff line number Diff line change @@ -301,8 +301,7 @@ void SwitchContext(CPed* thePed)
301
301
pGameInterface->SetGravity (data->m_fGravity );
302
302
303
303
// Disable mouselook for remote players (so the mouse doesn't affect them)
304
- // Only disable mouselook if they're not holding a 1st-person weapon
305
- // And if they're not under-water
304
+ // Disable mouselook if they're not holding a 1st-person weapon
306
305
bool bDisableMouseLook = true ;
307
306
if (pWeapon)
308
307
{
@@ -312,6 +311,15 @@ void SwitchContext(CPed* thePed)
312
311
bDisableMouseLook = false ;
313
312
}
314
313
}
314
+
315
+ // Disable mouse look if they're not in a fight task and not aiming (strafing)
316
+ // Fix GitHub Issue #395
317
+ if (thePed->GetCurrentWeaponSlot () == eWeaponSlot::WEAPONSLOT_TYPE_UNARMED && data->m_pad .NewState .RightShoulder1 != 0 && thePed->GetPedIntelligence ()->GetFightTask ())
318
+ bDisableMouseLook = false ;
319
+
320
+ // Disable mouse look if they're not underwater (Ped vertical rotation when diving)
321
+ // TODO - After merge PR #4401
322
+
315
323
bMouseLookEnabled = *(bool *)0xB6EC2E ;
316
324
if (bDisableMouseLook)
317
325
*(bool *)0xB6EC2E = false ;
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ class CPed;
15
15
class CTaskSAInterface ;
16
16
class CTaskManager ;
17
17
class CTaskSimpleUseGun ;
18
+ class CTaskSimpleFight ;
18
19
19
20
class CPedIntelligence
20
21
{
@@ -23,4 +24,5 @@ class CPedIntelligence
23
24
virtual bool TestForStealthKill (CPed* pPed, bool bUnk) = 0;
24
25
virtual CTaskSAInterface* SetTaskDuckSecondary (unsigned short nLengthOfDuck) = 0;
25
26
virtual CTaskSimpleUseGun* GetTaskUseGun () = 0;
27
+ virtual CTaskSimpleFight* GetFightTask () = 0;
26
28
};
You can’t perform that action at this time.
0 commit comments