mirror of
https://github.com/GTAmodding/re3.git
synced 2024-11-29 03:23:44 +00:00
Fix impossible bullets & turn speed on heavy guns
This commit is contained in:
parent
8641e9d0bb
commit
79856dac25
5 changed files with 116 additions and 23 deletions
|
@ -1120,8 +1120,12 @@ CPed::ClearAimFlag(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsPlayer())
|
if (IsPlayer()) {
|
||||||
((CPlayerPed*)this)->m_fFPSMoveHeading = 0.0f;
|
((CPlayerPed*)this)->m_fFPSMoveHeading = 0.0f;
|
||||||
|
#ifdef FREE_CAM
|
||||||
|
((CPlayerPed*)this)->m_bFreeAimActive = false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1361,7 +1365,7 @@ CPed::CalculateNewVelocity(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FREE_CAM
|
#ifdef FREE_CAM
|
||||||
if (!TheCamera.Cams[0].Using3rdPersonMouseCam())
|
if (!CCamera::bFreeCam || !TheCamera.Cams[0].Using3rdPersonMouseCam())
|
||||||
#endif
|
#endif
|
||||||
if (IsPlayer() && m_nPedState == PED_ATTACK)
|
if (IsPlayer() && m_nPedState == PED_ATTACK)
|
||||||
headAmount /= 4.0f;
|
headAmount /= 4.0f;
|
||||||
|
|
|
@ -311,9 +311,14 @@ CPed::SetAttack(CEntity *victim)
|
||||||
m_pLookTarget->RegisterReference((CEntity **) &m_pLookTarget);
|
m_pLookTarget->RegisterReference((CEntity **) &m_pLookTarget);
|
||||||
m_pSeekTarget->RegisterReference((CEntity **) &m_pSeekTarget);
|
m_pSeekTarget->RegisterReference((CEntity **) &m_pSeekTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_pLookTarget) {
|
if (m_pLookTarget) {
|
||||||
SetAimFlag(m_pLookTarget);
|
SetAimFlag(m_pLookTarget);
|
||||||
|
#ifdef FREE_CAM
|
||||||
|
} else if (this != FindPlayerPed() || !((CPlayerPed*)this)->m_bFreeAimActive) {
|
||||||
|
#else
|
||||||
} else {
|
} else {
|
||||||
|
#endif
|
||||||
SetAimFlag(m_fRotationCur);
|
SetAimFlag(m_fRotationCur);
|
||||||
|
|
||||||
if (FindPlayerPed() == this && TheCamera.Cams[0].Using3rdPersonMouseCam())
|
if (FindPlayerPed() == this && TheCamera.Cams[0].Using3rdPersonMouseCam())
|
||||||
|
@ -736,6 +741,15 @@ CPed::Attack(void)
|
||||||
weaponAnimAssoc->SetCurrentTime(ourWeapon->m_fAnimLoopEnd);
|
weaponAnimAssoc->SetCurrentTime(ourWeapon->m_fAnimLoopEnd);
|
||||||
weaponAnimAssoc->flags &= ~ASSOC_RUNNING;
|
weaponAnimAssoc->flags &= ~ASSOC_RUNNING;
|
||||||
SetPointGunAt(m_pPointGunAt);
|
SetPointGunAt(m_pPointGunAt);
|
||||||
|
#endif
|
||||||
|
#ifdef FREE_CAM
|
||||||
|
} else if (IsPlayer() && ((CPlayerPed*)this)->m_bFreeAimActive && GetWeapon()->m_eWeaponState != WEAPONSTATE_RELOADING) {
|
||||||
|
float limitedCam = CGeneral::LimitRadianAngle(-TheCamera.Orientation);
|
||||||
|
SetLookFlag(limitedCam, true);
|
||||||
|
SetAimFlag(limitedCam);
|
||||||
|
SetLookTimer(INT32_MAX);
|
||||||
|
SetPointGunAt(nil);
|
||||||
|
((CPlayerPed*)this)->m_fFPSMoveHeading = TheCamera.Find3rdPersonQuickAimPitch();
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
ClearAimFlag();
|
ClearAimFlag();
|
||||||
|
|
|
@ -504,7 +504,7 @@ CPlayerPed::DoWeaponSmoothSpray(void)
|
||||||
if (m_nPedState == PED_ATTACK && !m_pPointGunAt) {
|
if (m_nPedState == PED_ATTACK && !m_pPointGunAt) {
|
||||||
eWeaponType weapon = GetWeapon()->m_eWeaponType;
|
eWeaponType weapon = GetWeapon()->m_eWeaponType;
|
||||||
#ifdef FREE_CAM
|
#ifdef FREE_CAM
|
||||||
if(TheCamera.Cams[0].Using3rdPersonMouseCam() && (weapon == WEAPONTYPE_COLT45 || weapon == WEAPONTYPE_UZI))
|
if(CCamera::bFreeCam && TheCamera.Cams[0].Using3rdPersonMouseCam() && (weapon == WEAPONTYPE_COLT45 || weapon == WEAPONTYPE_UZI))
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
if (weapon == WEAPONTYPE_FLAMETHROWER || weapon == WEAPONTYPE_COLT45 || weapon == WEAPONTYPE_UZI || weapon == WEAPONTYPE_SHOTGUN ||
|
if (weapon == WEAPONTYPE_FLAMETHROWER || weapon == WEAPONTYPE_COLT45 || weapon == WEAPONTYPE_UZI || weapon == WEAPONTYPE_SHOTGUN ||
|
||||||
|
@ -1060,7 +1060,9 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
|
||||||
|
|
||||||
#ifdef FREE_CAM
|
#ifdef FREE_CAM
|
||||||
static int8 changedHeadingRate = 0;
|
static int8 changedHeadingRate = 0;
|
||||||
|
static int8 pointedGun = 0;
|
||||||
if (changedHeadingRate == 2) changedHeadingRate = 1;
|
if (changedHeadingRate == 2) changedHeadingRate = 1;
|
||||||
|
if (pointedGun == 2) pointedGun = 1;
|
||||||
|
|
||||||
// Rotate player/arm when shooting. We don't have auto-rotation anymore
|
// Rotate player/arm when shooting. We don't have auto-rotation anymore
|
||||||
if (CCamera::m_bUseMouse3rdPerson && CCamera::bFreeCam &&
|
if (CCamera::m_bUseMouse3rdPerson && CCamera::bFreeCam &&
|
||||||
|
@ -1071,22 +1073,28 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
|
||||||
if ((padUsed->GetTarget() && weaponInfo->IsFlagSet(WEAPONFLAG_CANAIM_WITHARM)) || padUsed->GetWeapon()) {
|
if ((padUsed->GetTarget() && weaponInfo->IsFlagSet(WEAPONFLAG_CANAIM_WITHARM)) || padUsed->GetWeapon()) {
|
||||||
float limitedCam = CGeneral::LimitRadianAngle(-TheCamera.Orientation);
|
float limitedCam = CGeneral::LimitRadianAngle(-TheCamera.Orientation);
|
||||||
|
|
||||||
|
m_cachedCamSource = TheCamera.Cams[TheCamera.ActiveCam].Source;
|
||||||
|
m_cachedCamFront = TheCamera.Cams[TheCamera.ActiveCam].Front;
|
||||||
|
m_cachedCamUp = TheCamera.Cams[TheCamera.ActiveCam].Up;
|
||||||
|
|
||||||
// On this one we can rotate arm.
|
// On this one we can rotate arm.
|
||||||
if (weaponInfo->IsFlagSet(WEAPONFLAG_CANAIM_WITHARM)) {
|
if (weaponInfo->IsFlagSet(WEAPONFLAG_CANAIM_WITHARM)) {
|
||||||
if (!padUsed->GetWeapon()) { // making this State != ATTACK still stops it after attack. Re-start it immediately!
|
pointedGun = 2;
|
||||||
SetPointGunAt(nil);
|
m_bFreeAimActive = true;
|
||||||
bIsPointingGunAt = false; // to not stop after attack
|
|
||||||
}
|
|
||||||
|
|
||||||
SetLookFlag(limitedCam, true);
|
SetLookFlag(limitedCam, true);
|
||||||
SetAimFlag(limitedCam);
|
SetAimFlag(limitedCam);
|
||||||
#ifdef VC_PED_PORTS
|
#ifdef VC_PED_PORTS
|
||||||
SetLookTimer(INT32_MAX); // removing this makes head move for real, but I experinced some bugs.
|
SetLookTimer(INT32_MAX); // removing this makes head move for real, but I experinced some bugs.
|
||||||
#endif
|
#endif
|
||||||
|
((CPlayerPed*)this)->m_fFPSMoveHeading = TheCamera.Find3rdPersonQuickAimPitch();
|
||||||
|
if (m_nPedState != PED_ATTACK && m_nPedState != PED_AIM_GUN) {
|
||||||
|
// This is a seperate ped state just for pointing gun. Used for target button
|
||||||
|
SetPointGunAt(nil);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
m_fRotationDest = limitedCam;
|
m_fRotationDest = limitedCam;
|
||||||
changedHeadingRate = 2;
|
changedHeadingRate = 2;
|
||||||
m_headingRate = 50.0f;
|
m_headingRate = 12.5f;
|
||||||
|
|
||||||
// Anim. fix for shotgun, ak47 and m16 (we must finish rot. it quickly)
|
// Anim. fix for shotgun, ak47 and m16 (we must finish rot. it quickly)
|
||||||
if (weaponInfo->IsFlagSet(WEAPONFLAG_CANAIM) && padUsed->WeaponJustDown()) {
|
if (weaponInfo->IsFlagSet(WEAPONFLAG_CANAIM) && padUsed->WeaponJustDown()) {
|
||||||
|
@ -1102,14 +1110,27 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
|
||||||
m_fRotationCur += (limitedRotDest - m_fRotationCur) / 2;
|
m_fRotationCur += (limitedRotDest - m_fRotationCur) / 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (weaponInfo->IsFlagSet(WEAPONFLAG_CANAIM_WITHARM) && m_nPedState != PED_ATTACK)
|
}
|
||||||
ClearPointGunAt();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (changedHeadingRate == 1) {
|
if (changedHeadingRate == 1) {
|
||||||
changedHeadingRate = 0;
|
changedHeadingRate = 0;
|
||||||
RestoreHeadingRate();
|
RestoreHeadingRate();
|
||||||
}
|
}
|
||||||
|
if (pointedGun == 1) {
|
||||||
|
if (m_nPedState == PED_ATTACK) {
|
||||||
|
if (!padUsed->GetWeapon() && (m_pedIK.m_flags & CPedIK::GUN_POINTED_SUCCESSFULLY) == 0) {
|
||||||
|
float limitedCam = CGeneral::LimitRadianAngle(-TheCamera.Orientation);
|
||||||
|
|
||||||
|
SetAimFlag(limitedCam);
|
||||||
|
((CPlayerPed*)this)->m_fFPSMoveHeading = TheCamera.Find3rdPersonQuickAimPitch();
|
||||||
|
m_bFreeAimActive = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
pointedGun = 0;
|
||||||
|
ClearPointGunAt();
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (padUsed->GetTarget() && m_nSelectedWepSlot == m_currentWeapon && m_nMoveState != PEDMOVE_SPRINT) {
|
if (padUsed->GetTarget() && m_nSelectedWepSlot == m_currentWeapon && m_nMoveState != PEDMOVE_SPRINT) {
|
||||||
|
@ -1188,7 +1209,7 @@ CPlayerPed::PlayerControlZelda(CPad *padUsed)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FREE_CAM
|
#ifdef FREE_CAM
|
||||||
if(TheCamera.Cams[0].Using3rdPersonMouseCam() && doSmoothSpray) {
|
if(CCamera::bFreeCam && TheCamera.Cams[0].Using3rdPersonMouseCam() && doSmoothSpray) {
|
||||||
padMoveInGameUnit = 0.0f;
|
padMoveInGameUnit = 0.0f;
|
||||||
smoothSprayWithoutMove = false;
|
smoothSprayWithoutMove = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,12 @@ public:
|
||||||
CPed *m_pPedAtSafePos[6];
|
CPed *m_pPedAtSafePos[6];
|
||||||
float m_fWalkAngle;
|
float m_fWalkAngle;
|
||||||
float m_fFPSMoveHeading;
|
float m_fFPSMoveHeading;
|
||||||
|
#ifdef FREE_CAM
|
||||||
|
bool m_bFreeAimActive;
|
||||||
|
CVector m_cachedCamSource;
|
||||||
|
CVector m_cachedCamFront;
|
||||||
|
CVector m_cachedCamUp;
|
||||||
|
#endif
|
||||||
|
|
||||||
CPlayerPed();
|
CPlayerPed();
|
||||||
~CPlayerPed();
|
~CPlayerPed();
|
||||||
|
|
|
@ -50,6 +50,29 @@ uint16 gReloadSampleTime[WEAPONTYPE_LAST_WEAPONTYPE] =
|
||||||
0 // HELICANNON
|
0 // HELICANNON
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef FREE_CAM
|
||||||
|
static bool
|
||||||
|
Find3rdPersonCamTargetVectorFromCachedVectors(float dist, CVector pos, CVector& source, CVector& target, CVector camSource, CVector camFront, CVector camUp)
|
||||||
|
{
|
||||||
|
if (CPad::GetPad(0)->GetLookBehindForPed()) {
|
||||||
|
source = pos;
|
||||||
|
target = dist * FindPlayerPed()->GetForward() + source;
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
float angleX = DEGTORAD((TheCamera.m_f3rdPersonCHairMultX - 0.5f) * 1.8f * 0.5f * TheCamera.Cams[TheCamera.ActiveCam].FOV * CDraw::GetAspectRatio());
|
||||||
|
float angleY = DEGTORAD((0.5f - TheCamera.m_f3rdPersonCHairMultY) * 1.8f * 0.5f * TheCamera.Cams[TheCamera.ActiveCam].FOV);
|
||||||
|
source = camSource;
|
||||||
|
target = camFront;
|
||||||
|
target += camUp * Tan(angleY);
|
||||||
|
target += CrossProduct(camFront, camUp) * Tan(angleX);
|
||||||
|
target.Normalise();
|
||||||
|
source += DotProduct(pos - source, target) * target;
|
||||||
|
target = dist * target + source;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
CWeaponInfo *
|
CWeaponInfo *
|
||||||
CWeapon::GetInfo()
|
CWeapon::GetInfo()
|
||||||
{
|
{
|
||||||
|
@ -591,17 +614,22 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
|
||||||
else if ( shooter == FindPlayerPed() && TheCamera.Cams[0].Using3rdPersonMouseCam() )
|
else if ( shooter == FindPlayerPed() && TheCamera.Cams[0].Using3rdPersonMouseCam() )
|
||||||
{
|
{
|
||||||
CVector src, trgt;
|
CVector src, trgt;
|
||||||
TheCamera.Find3rdPersonCamTargetVector(info->m_fRange, *fireSource, src, trgt);
|
|
||||||
#ifdef FREE_CAM
|
#ifdef FREE_CAM
|
||||||
CPed *shooterPed = (CPed *)shooter;
|
if (CCamera::bFreeCam) {
|
||||||
if((shooterPed->m_pedIK.m_flags & CPedIK::GUN_POINTED_SUCCESSFULLY) == 0) {
|
CPlayerPed *shooterPed = (CPlayerPed*)shooter;
|
||||||
trgt.x = info->m_fRange;
|
Find3rdPersonCamTargetVectorFromCachedVectors(info->m_fRange, *fireSource, src, trgt, shooterPed->m_cachedCamSource, shooterPed->m_cachedCamFront, shooterPed->m_cachedCamUp);
|
||||||
trgt.y = 0.0f;
|
if ((shooterPed->m_pedIK.m_flags & CPedIK::GUN_POINTED_SUCCESSFULLY) == 0) {
|
||||||
trgt.z = 0.0f;
|
trgt.x = info->m_fRange;
|
||||||
|
trgt.y = 0.0f;
|
||||||
|
trgt.z = 0.0f;
|
||||||
|
|
||||||
shooterPed->TransformToNode(trgt, PED_HANDR);
|
shooterPed->TransformToNode(trgt, PED_HANDR);
|
||||||
}
|
}
|
||||||
|
} else
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
|
TheCamera.Find3rdPersonCamTargetVector(info->m_fRange, *fireSource, src, trgt);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
// fix muzzleflash rotation
|
// fix muzzleflash rotation
|
||||||
|
@ -1209,8 +1237,19 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
|
||||||
|
|
||||||
if ( shooter == FindPlayerPed() && TheCamera.Cams[0].Using3rdPersonMouseCam() )
|
if ( shooter == FindPlayerPed() && TheCamera.Cams[0].Using3rdPersonMouseCam() )
|
||||||
{
|
{
|
||||||
TheCamera.Find3rdPersonCamTargetVector(1.0f, *fireSource, source, target);
|
CVector Left;
|
||||||
CVector Left = CrossProduct(TheCamera.Cams[TheCamera.ActiveCam].Front, TheCamera.Cams[TheCamera.ActiveCam].Up);
|
#ifdef FREE_CAM
|
||||||
|
if (CCamera::bFreeCam) {
|
||||||
|
CPlayerPed* shooterPed = (CPlayerPed*)shooter;
|
||||||
|
Find3rdPersonCamTargetVectorFromCachedVectors(1.0f, *fireSource, source, target, shooterPed->m_cachedCamSource, shooterPed->m_cachedCamFront, shooterPed->m_cachedCamUp);
|
||||||
|
Left = CrossProduct(shooterPed->m_cachedCamFront, shooterPed->m_cachedCamUp);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
TheCamera.Find3rdPersonCamTargetVector(1.0f, *fireSource, source, target);
|
||||||
|
Left = CrossProduct(TheCamera.Cams[TheCamera.ActiveCam].Front, TheCamera.Cams[TheCamera.ActiveCam].Up);
|
||||||
|
}
|
||||||
|
|
||||||
float f = float(i - 2) * (DEGTORAD(7.5f) / 2);
|
float f = float(i - 2) * (DEGTORAD(7.5f) / 2);
|
||||||
target = f * Left + target - source;
|
target = f * Left + target - source;
|
||||||
|
@ -1525,7 +1564,16 @@ CWeapon::FireAreaEffect(CEntity *shooter, CVector *fireSource)
|
||||||
|
|
||||||
if ( shooter == FindPlayerPed() && TheCamera.Cams[0].Using3rdPersonMouseCam() )
|
if ( shooter == FindPlayerPed() && TheCamera.Cams[0].Using3rdPersonMouseCam() )
|
||||||
{
|
{
|
||||||
TheCamera.Find3rdPersonCamTargetVector(info->m_fRange, *fireSource, source, target);
|
#ifdef FREE_CAM
|
||||||
|
if (CCamera::bFreeCam) {
|
||||||
|
CPlayerPed *shooterPed = (CPlayerPed*)shooter;
|
||||||
|
Find3rdPersonCamTargetVectorFromCachedVectors(info->m_fRange, *fireSource, source, target, shooterPed->m_cachedCamSource, shooterPed->m_cachedCamFront, shooterPed->m_cachedCamUp);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
TheCamera.Find3rdPersonCamTargetVector(info->m_fRange, *fireSource, source, target);
|
||||||
|
}
|
||||||
float norm = (1.0f / info->m_fRange);
|
float norm = (1.0f / info->m_fRange);
|
||||||
dir = (target - source) * norm;
|
dir = (target - source) * norm;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue