mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-11-26 19:14:15 +01:00
commit
9deabc7b60
@ -1233,8 +1233,12 @@ CPed::ClearAimFlag(void)
|
|||||||
m_lookTimer = 0;
|
m_lookTimer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
||||||
|
@ -345,11 +345,17 @@ CPed::SetAttack(CEntity *victim)
|
|||||||
|
|
||||||
if (m_pLookTarget) {
|
if (m_pLookTarget) {
|
||||||
SetAimFlag(m_pLookTarget);
|
SetAimFlag(m_pLookTarget);
|
||||||
} else if (this == FindPlayerPed() && TheCamera.Cams[0].Using3rdPersonMouseCam()) {
|
#ifdef FREE_CAM
|
||||||
SetAimFlag(m_fRotationCur);
|
} else if (this != FindPlayerPed() || !((CPlayerPed*)this)->m_bFreeAimActive) {
|
||||||
((CPlayerPed*)this)->m_fFPSMoveHeading = TheCamera.Find3rdPersonQuickAimPitch();
|
#else
|
||||||
} else if (curWeapon->IsFlagSet(WEAPONFLAG_CANAIM_WITHARM)) {
|
} else {
|
||||||
SetAimFlag(m_fRotationCur);
|
#endif
|
||||||
|
if (this == FindPlayerPed() && TheCamera.Cams[0].Using3rdPersonMouseCam()) {
|
||||||
|
SetAimFlag(m_fRotationCur);
|
||||||
|
((CPlayerPed*)this)->m_fFPSMoveHeading = TheCamera.Find3rdPersonQuickAimPitch();
|
||||||
|
} else if (curWeapon->IsFlagSet(WEAPONFLAG_CANAIM_WITHARM)) {
|
||||||
|
SetAimFlag(m_fRotationCur);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
@ -821,6 +827,9 @@ CPed::Attack(void)
|
|||||||
if (!bIsDucking && !GetFireAnimNotDucking(ourWeapon) && ourWeapon->IsFlagSet(WEAPONFLAG_CANAIM_WITHARM))
|
if (!bIsDucking && !GetFireAnimNotDucking(ourWeapon) && ourWeapon->IsFlagSet(WEAPONFLAG_CANAIM_WITHARM))
|
||||||
m_pedIK.m_flags |= CPedIK::AIMS_WITH_ARM;
|
m_pedIK.m_flags |= CPedIK::AIMS_WITH_ARM;
|
||||||
else
|
else
|
||||||
|
#ifdef FREE_CAM
|
||||||
|
if (!IsPlayer() || !((CPlayerPed*)this)->m_bFreeAimActive)
|
||||||
|
#endif
|
||||||
m_pedIK.m_flags &= ~CPedIK::AIMS_WITH_ARM;
|
m_pedIK.m_flags &= ~CPedIK::AIMS_WITH_ARM;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1017,6 +1026,15 @@ CPed::Attack(void)
|
|||||||
weaponAnimAssoc->SetCurrentTime(animLoopEnd);
|
weaponAnimAssoc->SetCurrentTime(animLoopEnd);
|
||||||
weaponAnimAssoc->flags &= ~ASSOC_RUNNING;
|
weaponAnimAssoc->flags &= ~ASSOC_RUNNING;
|
||||||
SetPointGunAt(m_pPointGunAt);
|
SetPointGunAt(m_pPointGunAt);
|
||||||
|
#ifdef FREE_CAM
|
||||||
|
} else if (IsPlayer() && ((CPlayerPed*)this)->m_bFreeAimActive && GetWeapon()->m_eWeaponState != WEAPONSTATE_RELOADING) {
|
||||||
|
float limitedCam = CGeneral::LimitRadianAngle(-TheCamera.Orientation);
|
||||||
|
SetLookFlag(limitedCam, true, true);
|
||||||
|
SetAimFlag(limitedCam);
|
||||||
|
SetLookTimer(INT32_MAX);
|
||||||
|
SetPointGunAt(nil);
|
||||||
|
((CPlayerPed*)this)->m_fFPSMoveHeading = TheCamera.Find3rdPersonQuickAimPitch();
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
ClearAimFlag();
|
ClearAimFlag();
|
||||||
|
|
||||||
|
@ -98,6 +98,9 @@ CPlayerPed::CPlayerPed(void) : CPed(PEDTYPE_PLAYER1)
|
|||||||
m_nAttackDirToCheck = 0;
|
m_nAttackDirToCheck = 0;
|
||||||
m_nLastBusFareCollected = 0;
|
m_nLastBusFareCollected = 0;
|
||||||
idleAnimBlockIndex = CAnimManager::GetAnimationBlockIndex("playidles");
|
idleAnimBlockIndex = CAnimManager::GetAnimationBlockIndex("playidles");
|
||||||
|
#ifdef FREE_CAM
|
||||||
|
m_bFreeAimActive = false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1342,17 +1345,22 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
|
|||||||
if ((padUsed->GetTarget() && CAN_AIM_WITH_ARM) || padUsed->GetWeapon()) {
|
if ((padUsed->GetTarget() && CAN_AIM_WITH_ARM) || 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 (CAN_AIM_WITH_ARM) {
|
if (CAN_AIM_WITH_ARM) {
|
||||||
if (!padUsed->GetWeapon()) { // making this State != ATTACK still stops it after attack. Re-start it immediately!
|
|
||||||
SetPointGunAt(nil);
|
|
||||||
bIsPointingGunAt = false; // to not stop after attack
|
|
||||||
}
|
|
||||||
pointedGun = 2;
|
pointedGun = 2;
|
||||||
SetLookFlag(limitedCam, true);
|
m_bFreeAimActive = true;
|
||||||
|
SetLookFlag(limitedCam, true, true);
|
||||||
SetAimFlag(limitedCam);
|
SetAimFlag(limitedCam);
|
||||||
SetLookTimer(INT32_MAX); // removing this makes head move for real, but I experinced some bugs.
|
SetLookTimer(INT32_MAX);
|
||||||
|
((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;
|
||||||
@ -1380,9 +1388,19 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
|
|||||||
changedHeadingRate = 0;
|
changedHeadingRate = 0;
|
||||||
RestoreHeadingRate();
|
RestoreHeadingRate();
|
||||||
}
|
}
|
||||||
if (pointedGun == 1 && m_nPedState != PED_ATTACK) {
|
if (pointedGun == 1) {
|
||||||
pointedGun = 0;
|
if (m_nPedState == PED_ATTACK) {
|
||||||
ClearPointGunAt();
|
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
|
||||||
|
|
||||||
|
@ -44,6 +44,12 @@ public:
|
|||||||
float m_fGunSpinAngle;
|
float m_fGunSpinAngle;
|
||||||
unsigned int m_nPadDownPressedInMilliseconds;
|
unsigned int m_nPadDownPressedInMilliseconds;
|
||||||
unsigned int m_nLastBusFareCollected;
|
unsigned int m_nLastBusFareCollected;
|
||||||
|
#ifdef FREE_CAM
|
||||||
|
bool m_bFreeAimActive;
|
||||||
|
CVector m_cachedCamSource;
|
||||||
|
CVector m_cachedCamFront;
|
||||||
|
CVector m_cachedCamUp;
|
||||||
|
#endif
|
||||||
|
|
||||||
static bool bDontAllowWeaponChange;
|
static bool bDontAllowWeaponChange;
|
||||||
#ifndef MASTER
|
#ifndef MASTER
|
||||||
|
@ -49,6 +49,29 @@ bool CWeapon::bPhotographHasBeenTaken;
|
|||||||
int32 sniperPirateCheck = 0x00797743; // 'Cwy\0' ???
|
int32 sniperPirateCheck = 0x00797743; // 'Cwy\0' ???
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#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((CCamera::m_f3rdPersonCHairMultX - 0.5f) * 1.8f * 0.5f * TheCamera.Cams[TheCamera.ActiveCam].FOV * CDraw::GetAspectRatio());
|
||||||
|
float angleY = DEGTORAD((0.5f - CCamera::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()
|
||||||
{
|
{
|
||||||
@ -943,17 +966,23 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
|
|||||||
}
|
}
|
||||||
else if ( shooter == FindPlayerPed() && TheCamera.Cams[0].Using3rdPersonMouseCam() )
|
else if ( shooter == FindPlayerPed() && TheCamera.Cams[0].Using3rdPersonMouseCam() )
|
||||||
{
|
{
|
||||||
TheCamera.Find3rdPersonCamTargetVector(info->m_fRange, *fireSource, source, target);
|
|
||||||
#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;
|
||||||
target.x = info->m_fRange;
|
Find3rdPersonCamTargetVectorFromCachedVectors(info->m_fRange, *fireSource, source, target, shooterPed->m_cachedCamSource, shooterPed->m_cachedCamFront, shooterPed->m_cachedCamUp);
|
||||||
target.y = 0.0f;
|
|
||||||
target.z = 0.0f;
|
|
||||||
|
|
||||||
shooterPed->TransformToNode(target, PED_HANDR);
|
if ((shooterPed->m_pedIK.m_flags & CPedIK::GUN_POINTED_SUCCESSFULLY) == 0) {
|
||||||
}
|
target.x = info->m_fRange;
|
||||||
|
target.y = 0.0f;
|
||||||
|
target.z = 0.0f;
|
||||||
|
|
||||||
|
shooterPed->TransformToNode(target, PED_HANDR);
|
||||||
|
}
|
||||||
|
} else
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
|
TheCamera.Find3rdPersonCamTargetVector(info->m_fRange, *fireSource, source, target);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
// fix muzzleflash rotation
|
// fix muzzleflash rotation
|
||||||
@ -1708,8 +1737,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 = (i - (shootsAtOnce / 2)) * angleBetweenTwoShot;
|
float f = (i - (shootsAtOnce / 2)) * angleBetweenTwoShot;
|
||||||
target = f * Left + target - source;
|
target = f * Left + target - source;
|
||||||
@ -2151,7 +2191,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 New Issue
Block a user