mirror of
https://github.com/halpz/re3.git
synced 2025-06-30 09:36:21 +00:00
Mouse free cam for peds&cars (under FREE_CAM)
This commit is contained in:
@ -59,6 +59,10 @@
|
||||
|
||||
#define CAN_SEE_ENTITY_ANGLE_THRESHOLD DEGTORAD(60.0f)
|
||||
|
||||
#ifdef FREE_CAM
|
||||
extern bool bFreeMouseCam;
|
||||
#endif
|
||||
|
||||
CPed *gapTempPedList[50];
|
||||
uint16 gnNumTempPedList;
|
||||
|
||||
@ -807,6 +811,10 @@ CPed::IsPedInControl(void)
|
||||
bool
|
||||
CPed::CanStrafeOrMouseControl(void)
|
||||
{
|
||||
#ifdef FREE_CAM
|
||||
if (bFreeMouseCam)
|
||||
return false;
|
||||
#endif
|
||||
return m_nPedState == PED_NONE || m_nPedState == PED_IDLE || m_nPedState == PED_FLEE_POS || m_nPedState == PED_FLEE_ENTITY ||
|
||||
m_nPedState == PED_ATTACK || m_nPedState == PED_FIGHT || m_nPedState == PED_AIM_GUN || m_nPedState == PED_JUMP;
|
||||
}
|
||||
@ -6984,7 +6992,11 @@ CPed::FinishLaunchCB(CAnimBlendAssociation *animAssoc, void *arg)
|
||||
#endif
|
||||
) {
|
||||
|
||||
#ifdef FREE_CAM
|
||||
if (TheCamera.Cams[0].Using3rdPersonMouseCam() && !bFreeMouseCam) {
|
||||
#else
|
||||
if (TheCamera.Cams[0].Using3rdPersonMouseCam()) {
|
||||
#endif
|
||||
float fpsAngle = ped->WorkOutHeadingForMovingFirstPerson(ped->m_fRotationCur);
|
||||
ped->m_vecMoveSpeed.x = -velocityFromAnim * Sin(fpsAngle);
|
||||
ped->m_vecMoveSpeed.y = velocityFromAnim * Cos(fpsAngle);
|
||||
|
@ -18,6 +18,10 @@
|
||||
|
||||
#define PAD_MOVE_TO_GAME_WORLD_MOVE 60.0f
|
||||
|
||||
#ifdef FREE_CAM
|
||||
extern bool bFreeMouseCam;
|
||||
#endif
|
||||
|
||||
CPlayerPed::~CPlayerPed()
|
||||
{
|
||||
delete m_pWanted;
|
||||
@ -65,7 +69,7 @@ void CPlayerPed::ClearWeaponTarget()
|
||||
TheCamera.ClearPlayerWeaponMode();
|
||||
CWeaponEffects::ClearCrossHair();
|
||||
}
|
||||
ClearPointGunAt();
|
||||
ClearPointGunAt();
|
||||
}
|
||||
|
||||
void
|
||||
@ -688,7 +692,14 @@ CPlayerPed::PlayerControl1stPersonRunAround(CPad *padUsed)
|
||||
float padMove = CVector2D(leftRight, upDown).Magnitude();
|
||||
float padMoveInGameUnit = padMove / PAD_MOVE_TO_GAME_WORLD_MOVE;
|
||||
if (padMoveInGameUnit > 0.0f) {
|
||||
#ifdef FREE_CAM
|
||||
if (!bFreeMouseCam)
|
||||
m_fRotationDest = CGeneral::LimitRadianAngle(TheCamera.Orientation);
|
||||
else
|
||||
m_fRotationDest = CGeneral::GetRadianAngleBetweenPoints(0.0f, 0.0f, -leftRight, upDown) - TheCamera.Orientation;
|
||||
#else
|
||||
m_fRotationDest = CGeneral::LimitRadianAngle(TheCamera.Orientation);
|
||||
#endif
|
||||
m_fMoveSpeed = min(padMoveInGameUnit, 0.07f * CTimer::GetTimeStep() + m_fMoveSpeed);
|
||||
} else {
|
||||
m_fMoveSpeed = 0.0f;
|
||||
@ -981,6 +992,12 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
|
||||
if (padUsed->TargetJustDown()) {
|
||||
SetStoredState();
|
||||
m_nPedState = PED_SNIPER_MODE;
|
||||
#ifdef FREE_CAM
|
||||
if (bFreeMouseCam && TheCamera.Cams[0].Using3rdPersonMouseCam()) {
|
||||
m_fRotationCur = CGeneral::LimitRadianAngle(-TheCamera.Orientation);
|
||||
SetHeading(m_fRotationCur);
|
||||
}
|
||||
#endif
|
||||
if (GetWeapon()->m_eWeaponType == WEAPONTYPE_ROCKETLAUNCHER)
|
||||
TheCamera.SetNewPlayerWeaponMode(CCam::MODE_ROCKETLAUNCHER, 0, 0);
|
||||
else if (GetWeapon()->m_eWeaponType == WEAPONTYPE_SNIPERRIFLE)
|
||||
@ -1000,7 +1017,12 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
|
||||
if (padUsed->GetWeapon() && m_nMoveState != PEDMOVE_SPRINT) {
|
||||
if (m_nSelectedWepSlot == m_currentWeapon) {
|
||||
if (m_pPointGunAt) {
|
||||
SetAttack(m_pPointGunAt);
|
||||
#ifdef FREE_CAM
|
||||
if (bFreeMouseCam && weaponInfo->m_eWeaponFire == WEAPON_FIRE_MELEE && m_fMoveSpeed < 1.0f)
|
||||
StartFightAttack(padUsed->GetWeapon());
|
||||
else
|
||||
#endif
|
||||
SetAttack(m_pPointGunAt);
|
||||
} else if (m_currentWeapon != WEAPONTYPE_UNARMED) {
|
||||
if (m_nPedState == PED_ATTACK) {
|
||||
if (padUsed->WeaponJustDown()) {
|
||||
@ -1027,11 +1049,65 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
|
||||
bIsAttacking = false;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef FREE_CAM
|
||||
// Rotate player/arm when shooting. We don't have auto-rotation anymore
|
||||
if (CCamera::m_bUseMouse3rdPerson && bFreeMouseCam &&
|
||||
m_nSelectedWepSlot == m_currentWeapon && m_nMoveState != PEDMOVE_SPRINT) {
|
||||
|
||||
// Weapons except throwable and melee ones
|
||||
if (weaponInfo->m_bCanAim || weaponInfo->m_b1stPerson || weaponInfo->m_bExpands) {
|
||||
if ((padUsed->GetTarget() && weaponInfo->m_bCanAimWithArm) || padUsed->GetWeapon()) {
|
||||
float limitedCam = CGeneral::LimitRadianAngle(-TheCamera.Orientation);
|
||||
|
||||
// On this one we can rotate arm.
|
||||
if (weaponInfo->m_bCanAimWithArm) {
|
||||
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
|
||||
}
|
||||
|
||||
SetLookFlag(limitedCam, true);
|
||||
SetAimFlag(limitedCam);
|
||||
#ifdef VC_PED_PORTS
|
||||
SetLookTimer(INT_MAX); // removing this makes head move for real, but I experinced some bugs.
|
||||
#endif
|
||||
} else {
|
||||
m_fRotationDest = limitedCam;
|
||||
m_headingRate = 50.0f;
|
||||
|
||||
// Anim. fix for shotgun, ak47 and m16 (we must finish rot. it quickly)
|
||||
if (weaponInfo->m_bCanAim && padUsed->WeaponJustDown()) {
|
||||
m_fRotationCur = CGeneral::LimitRadianAngle(m_fRotationCur);
|
||||
float limitedRotDest = m_fRotationDest;
|
||||
|
||||
if (m_fRotationCur - PI > m_fRotationDest) {
|
||||
limitedRotDest += 2 * PI;
|
||||
} else if (PI + m_fRotationCur < m_fRotationDest) {
|
||||
limitedRotDest -= 2 * PI;
|
||||
}
|
||||
|
||||
m_fRotationCur += (limitedRotDest - m_fRotationCur) / 2;
|
||||
}
|
||||
}
|
||||
} else if (weaponInfo->m_bCanAimWithArm)
|
||||
ClearPointGunAt();
|
||||
else
|
||||
RestoreHeadingRate();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (padUsed->GetTarget() && m_nSelectedWepSlot == m_currentWeapon && m_nMoveState != PEDMOVE_SPRINT) {
|
||||
if (m_pPointGunAt) {
|
||||
// what??
|
||||
if (!m_pPointGunAt
|
||||
|| CCamera::m_bUseMouse3rdPerson || m_pPointGunAt->IsPed() && ((CPed*)m_pPointGunAt)->bInVehicle) {
|
||||
#ifdef FREE_CAM
|
||||
|| (!bFreeMouseCam && CCamera::m_bUseMouse3rdPerson)
|
||||
#else
|
||||
|| CCamera::m_bUseMouse3rdPerson
|
||||
#endif
|
||||
|| m_pPointGunAt->IsPed() && ((CPed*)m_pPointGunAt)->bInVehicle) {
|
||||
ClearWeaponTarget();
|
||||
return;
|
||||
}
|
||||
@ -1047,7 +1123,12 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
|
||||
}
|
||||
TheCamera.SetNewPlayerWeaponMode(CCam::MODE_SYPHON, 0, 0);
|
||||
TheCamera.UpdateAimingCoors(m_pPointGunAt->GetPosition());
|
||||
} else if (weaponInfo->m_bCanAim && !CCamera::m_bUseMouse3rdPerson) {
|
||||
}
|
||||
#ifdef FREE_CAM
|
||||
else if ((bFreeMouseCam && weaponInfo->m_eWeaponFire == WEAPON_FIRE_MELEE) || (weaponInfo->m_bCanAim && !CCamera::m_bUseMouse3rdPerson)) {
|
||||
#else
|
||||
else if (weaponInfo->m_bCanAim && !CCamera::m_bUseMouse3rdPerson) {
|
||||
#endif
|
||||
if (padUsed->TargetJustDown())
|
||||
FindWeaponLockOnTarget();
|
||||
}
|
||||
|
Reference in New Issue
Block a user