Merge remote-tracking branch 'origin/master' into MoreLanguages

This commit is contained in:
Sergeanur 2020-04-05 17:03:59 +03:00
commit 4fc2f9c359
20 changed files with 3548 additions and 450 deletions

View File

@ -42,7 +42,6 @@ cAudioManager - WIP
CBoat
CBrightLights
CBulletInfo
CCamera
CCrane
CCranes
CCullZone

View File

@ -1464,8 +1464,9 @@ void CGarage::UpdateDoorsHeight()
void CGarage::BuildRotatedDoorMatrix(CEntity * pDoor, float fPosition)
{
float fAngle = -fPosition * HALFPI;
CVector r(-Sin(fAngle) * pDoor->GetForward().x, Sin(fAngle) * pDoor->GetForward().y, Cos(fAngle) * pDoor->GetForward().z);
pDoor->GetRight() = CrossProduct(r, pDoor->GetForward());
CVector up(-Sin(fAngle) * pDoor->GetForward().y, Sin(fAngle) * pDoor->GetForward().z, Cos(fAngle));
pDoor->GetRight() = CrossProduct(up, pDoor->GetForward());
pDoor->GetUp() = up;
}
void CGarage::UpdateCrusherAngle()

View File

@ -5,6 +5,7 @@
#include "config.h"
class CVehicle;
class CCamera;
enum eGarageState : int8
{
@ -168,6 +169,7 @@ class CGarage
friend class CGarages;
friend class cAudioManager;
friend class CCamera;
};
static_assert(sizeof(CGarage) == 140, "CGarage");

View File

@ -35,7 +35,7 @@ CRemote::GivePlayerRemoteControlledCar(float x, float y, float z, float rot, uin
CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle = car;
CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->RegisterReference((CEntity**)&CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle);
TheCamera.TakeControl(car, CCam::MODE_BEHINDCAR, INTERPOLATION, CAM_CONTROLLER_1);
TheCamera.TakeControl(car, CCam::MODE_BEHINDCAR, INTERPOLATION, CAMCONTROL_SCRIPT);
}
void

View File

@ -2,6 +2,7 @@
#include "patcher.h"
#include "SceneEdit.h"
bool &CSceneEdit::m_bEditOn = *(bool*)0x95CD77;
int32 &CSceneEdit::m_bCameraFollowActor = *(int*)0x940590;
bool &CSceneEdit::m_bRecording = *(bool*)0x95CD1F;
CVector &CSceneEdit::m_vecCurrentPosition = *(CVector*)0x943064;

View File

@ -3,6 +3,7 @@
class CSceneEdit
{
public:
static bool &m_bEditOn;
static int32 &m_bCameraFollowActor;
static bool &m_bRecording;
static CVector &m_vecCurrentPosition;

View File

@ -3073,7 +3073,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
{
CollectParameters(&m_nIp, 3);
// ScriptParams[0] is unused.
TheCamera.TakeControl(nil, ScriptParams[1], ScriptParams[2], CAM_CONTROLLER_1);
TheCamera.TakeControl(nil, ScriptParams[1], ScriptParams[2], CAMCONTROL_SCRIPT);
return 0;
}
case COMMAND_POINT_CAMERA_AT_CAR:
@ -3081,7 +3081,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
CollectParameters(&m_nIp, 3);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(pVehicle);
TheCamera.TakeControl(pVehicle, ScriptParams[1], ScriptParams[2], CAM_CONTROLLER_1);
TheCamera.TakeControl(pVehicle, ScriptParams[1], ScriptParams[2], CAMCONTROL_SCRIPT);
return 0;
}
case COMMAND_POINT_CAMERA_AT_CHAR:
@ -3089,7 +3089,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
CollectParameters(&m_nIp, 3);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed);
TheCamera.TakeControl(pPed, ScriptParams[1], ScriptParams[2], CAM_CONTROLLER_1);
TheCamera.TakeControl(pPed, ScriptParams[1], ScriptParams[2], CAMCONTROL_SCRIPT);
return 0;
}
case COMMAND_RESTORE_CAMERA:
@ -3140,7 +3140,7 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
CVector pos = *(CVector*)&ScriptParams[0];
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
TheCamera.TakeControlNoEntity(pos, ScriptParams[3], CAM_CONTROLLER_1);
TheCamera.TakeControlNoEntity(pos, ScriptParams[3], CAMCONTROL_SCRIPT);
return 0;
}
case COMMAND_ADD_BLIP_FOR_CAR_OLD:

View File

@ -294,7 +294,7 @@ CAnimViewer::Update(void)
}
newEntity->GetPosition() = CVector(0.0f, 0.0f, 0.0f);
CWorld::Add(newEntity);
TheCamera.TakeControl(pTarget, CCam::MODE_MODELVIEW, JUMP_CUT, CAM_CONTROLLER_1);
TheCamera.TakeControl(pTarget, CCam::MODE_MODELVIEW, JUMP_CUT, CAMCONTROL_SCRIPT);
}
if (pTarget->m_type == ENTITY_TYPE_VEHICLE || pTarget->m_type == ENTITY_TYPE_PED || pTarget->m_type == ENTITY_TYPE_OBJECT) {
((CPhysical*)pTarget)->m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);

View File

@ -31,8 +31,7 @@ bool PrintDebugCode = false;
int16 &DebugCamMode = *(int16*)0x95CCF2;
#ifdef FREE_CAM
bool bFreePadCam = false;
bool bFreeMouseCam = false;
bool CCamera::bFreeCam = false;
int nPreviousMode = -1;
#endif
@ -146,7 +145,7 @@ CCam::Process(void)
Process_FollowPedWithMouse(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
else
#ifdef FREE_CAM
if(bFreePadCam)
if(CCamera::bFreeCam)
Process_FollowPed_Rotation(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
else
#endif
@ -187,7 +186,7 @@ CCam::Process(void)
break;
case MODE_CAM_ON_A_STRING:
#ifdef FREE_CAM
if(bFreeMouseCam || bFreePadCam)
if(CCamera::bFreeCam)
Process_FollowCar_SA(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
else
#endif
@ -204,7 +203,7 @@ CCam::Process(void)
break;
case MODE_BEHINDBOAT:
#ifdef FREE_CAM
if (bFreeMouseCam || bFreePadCam)
if (CCamera::bFreeCam)
Process_FollowCar_SA(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
else
#endif
@ -267,7 +266,7 @@ CCam::Process(void)
float DistOnGround = TargetToCam.Magnitude2D();
m_fTrueBeta = CGeneral::GetATanOfXY(TargetToCam.x, TargetToCam.y);
m_fTrueAlpha = CGeneral::GetATanOfXY(TargetToCam.z, DistOnGround);
if(TheCamera.m_uiTransitionState == 0) // TODO? what values are possible? enum?
if(TheCamera.m_uiTransitionState == 0)
KeepTrackOfTheSpeed(Source, m_cvecTargetCoorsForFudgeInter, Up, m_fTrueAlpha, m_fTrueBeta, FOV);
// Look Behind, Left, Right
@ -421,11 +420,11 @@ CCam::ProcessSpecialHeightRoutines(void)
float DistScale = (2.1f - dist)/2.1f;
if(Mode == MODE_FOLLOWPED){
if(TheCamera.PedZoomIndicator == 1.0f)
if(TheCamera.PedZoomIndicator == CAM_ZOOM_1)
Offset = 0.45*DistScale + PedZDist;
if(TheCamera.PedZoomIndicator == 2.0f)
if(TheCamera.PedZoomIndicator == CAM_ZOOM_2)
Offset = 0.35*DistScale + PedZDist;
if(TheCamera.PedZoomIndicator == 3.0f)
if(TheCamera.PedZoomIndicator == CAM_ZOOM_3)
Offset = 0.25*DistScale + PedZDist;
if(Abs(CGeneral::GetRadianAngleBetweenPoints(CamToPed.x, CamToPed.y, CamToTarget.x, CamToTarget.y)) > HALFPI)
Offset += 0.3f;
@ -575,11 +574,11 @@ CCam::ProcessSpecialHeightRoutines(void)
m_fRoadOffSet = 1.4f;
}else{
if(Mode == MODE_FOLLOWPED){
if(TheCamera.PedZoomIndicator == 1.0f)
if(TheCamera.PedZoomIndicator == CAM_ZOOM_1)
m_fRoadOffSet += 0.2f;
if(TheCamera.PedZoomIndicator == 2.0f)
if(TheCamera.PedZoomIndicator == CAM_ZOOM_2)
m_fRoadOffSet += 0.5f;
if(TheCamera.PedZoomIndicator == 3.0f)
if(TheCamera.PedZoomIndicator == CAM_ZOOM_3)
m_fRoadOffSet += 0.95f;
}
}
@ -628,7 +627,7 @@ CCam::LookBehind(void)
DeltaBeta = TargetOrientation - Beta;
while(DeltaBeta >= PI) DeltaBeta -= 2*PI;
while(DeltaBeta < -PI) DeltaBeta += 2*PI;
if(DirectionWasLooking == LOOKING_BEHIND)
if(DirectionWasLooking != LOOKING_BEHIND)
LookBehindCamWasInFront = DeltaBeta <= -HALFPI || DeltaBeta >= HALFPI;
if(LookBehindCamWasInFront)
TargetOrientation += PI;
@ -636,7 +635,7 @@ CCam::LookBehind(void)
Source.y = Dist*Sin(TargetOrientation) + TargetCoors.y;
Source.z -= 1.0f;
if(CWorld::ProcessLineOfSight(TargetCoors, Source, colPoint, entity, true, false, false, true, false, true, true)){
RwCameraSetNearClipPlane(Scene.camera, 0.9f);
RwCameraSetNearClipPlane(Scene.camera, DEFAULT_NEAR);
Source = colPoint.point;
}
Source.z += 1.0f;
@ -800,7 +799,7 @@ CCam::ClipIfPedInFrontOfPlayer(void)
if(Abs(DeltaAngle) < HALFPI){
fDist = Sqrt(SQR(vDist.x) + SQR(vDist.y));
if(fDist < 1.25f){
Near = 0.9f - (1.25f - fDist);
Near = DEFAULT_NEAR - (1.25f - fDist);
if(Near < 0.05f)
Near = 0.05f;
RwCameraSetNearClipPlane(Scene.camera, Near);
@ -1044,7 +1043,7 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl
}else{
LateralDist = 0.8f;
CenterDist = 1.35f;
if(TheCamera.PedZoomIndicator == 1.0f || TheCamera.PedZoomIndicator == 4.0f){
if(TheCamera.PedZoomIndicator == CAM_ZOOM_1 || TheCamera.PedZoomIndicator == CAM_ZOOM_TOPDOWN){
LateralDist = 1.25f;
CenterDist = 1.6f;
}
@ -1082,7 +1081,6 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl
else
IdealSource = TargetCoors + CVector(1.0f, 1.0f, 0.0f);
// TODO: what's transition beta?
if(TheCamera.m_bUseTransitionBeta && ResetStatics){
CVector VecDistance;
IdealSource.x = TargetCoors.x + GroundDist*Cos(m_fTransitionBeta);
@ -1111,17 +1109,17 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl
// BUG? is this ever used?
// The values seem to be roughly m_fPedZoomValueSmooth + 1.85
if(ResetStatics){
if(TheCamera.PedZoomIndicator == 1.0) m_fRealGroundDist = 2.090556f;
if(TheCamera.PedZoomIndicator == 2.0) m_fRealGroundDist = 3.34973f;
if(TheCamera.PedZoomIndicator == 3.0) m_fRealGroundDist = 4.704914f;
if(TheCamera.PedZoomIndicator == 4.0) m_fRealGroundDist = 2.090556f;
if(TheCamera.PedZoomIndicator == CAM_ZOOM_1) m_fRealGroundDist = 2.090556f;
if(TheCamera.PedZoomIndicator == CAM_ZOOM_2) m_fRealGroundDist = 3.34973f;
if(TheCamera.PedZoomIndicator == CAM_ZOOM_3) m_fRealGroundDist = 4.704914f;
if(TheCamera.PedZoomIndicator == CAM_ZOOM_TOPDOWN) m_fRealGroundDist = 2.090556f;
}
// And what is this? It's only used for collision and rotation it seems
float RealGroundDist;
if(TheCamera.PedZoomIndicator == 1.0) RealGroundDist = 2.090556f;
if(TheCamera.PedZoomIndicator == 2.0) RealGroundDist = 3.34973f;
if(TheCamera.PedZoomIndicator == 3.0) RealGroundDist = 4.704914f;
if(TheCamera.PedZoomIndicator == 4.0) RealGroundDist = 2.090556f;
if(TheCamera.PedZoomIndicator == CAM_ZOOM_1) RealGroundDist = 2.090556f;
if(TheCamera.PedZoomIndicator == CAM_ZOOM_2) RealGroundDist = 3.34973f;
if(TheCamera.PedZoomIndicator == CAM_ZOOM_3) RealGroundDist = 4.704914f;
if(TheCamera.PedZoomIndicator == CAM_ZOOM_TOPDOWN) RealGroundDist = 2.090556f;
if(m_fCloseInPedHeightOffset > 0.00001f)
RealGroundDist = 1.7016f;
@ -1292,8 +1290,8 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl
// Now do the Beta rotation
float Distance = (IdealSource - TargetCoors).Magnitude2D();
m_fDistanceBeforeChanges = Distance;
float RotDistance = (IdealSource - TargetCoors).Magnitude2D();
m_fDistanceBeforeChanges = RotDistance;
if(Rotating){
m_bFixingBeta = true;
@ -1334,8 +1332,8 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl
BetaSpeed = 0.0f;
}
Source.x = TargetCoors.x + Distance * Cos(Beta);
Source.y = TargetCoors.y + Distance * Sin(Beta);
Source.x = TargetCoors.x + RotDistance * Cos(Beta);
Source.y = TargetCoors.y + RotDistance * Sin(Beta);
// Check if we can stop rotating
DeltaBeta = FixedTargetOrientation - Beta;
@ -1354,18 +1352,18 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl
HackPlayerOnStoppingTrain || Rotating){
if(TheCamera.m_bCamDirectlyBehind){
Beta = TargetOrientation + PI;
Source.x = TargetCoors.x + Distance * Cos(Beta);
Source.y = TargetCoors.y + Distance * Sin(Beta);
Source.x = TargetCoors.x + RotDistance * Cos(Beta);
Source.y = TargetCoors.y + RotDistance * Sin(Beta);
}
if(TheCamera.m_bCamDirectlyInFront){
Beta = TargetOrientation;
Source.x = TargetCoors.x + Distance * Cos(Beta);
Source.y = TargetCoors.y + Distance * Sin(Beta);
Source.x = TargetCoors.x + RotDistance * Cos(Beta);
Source.y = TargetCoors.y + RotDistance * Sin(Beta);
}
if(HackPlayerOnStoppingTrain){
Beta = TargetOrientation + PI;
Source.x = TargetCoors.x + Distance * Cos(Beta);
Source.y = TargetCoors.y + Distance * Sin(Beta);
Source.x = TargetCoors.x + RotDistance * Cos(Beta);
Source.y = TargetCoors.y + RotDistance * Sin(Beta);
m_fDimensionOfHighestNearCar = 0.0f;
m_fCamBufferedHeight = 0.0f;
m_fCamBufferedHeightSpeed = 0.0f;
@ -1551,7 +1549,7 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient
// SA code
#ifdef FREE_CAM
if((bFreeMouseCam && Alpha > 0.0f) || (!bFreeMouseCam && Alpha > fBaseDist))
if((CCamera::bFreeCam && Alpha > 0.0f) || (!CCamera::bFreeCam && Alpha > fBaseDist))
#else
if(Alpha > fBaseDist) // comparing an angle against a distance?
#endif
@ -1586,14 +1584,14 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient
if(CWorld::ProcessLineOfSight(colPoint.point, Source, colPoint, entity, true, true, true, true, false, false, true)){
PedColDist = (TargetCoors - colPoint.point).Magnitude();
Source = colPoint.point;
if(PedColDist < 0.9f + 0.3f)
if(PedColDist < DEFAULT_NEAR + 0.3f)
RwCameraSetNearClipPlane(Scene.camera, max(PedColDist-0.3f, 0.05f));
}else{
RwCameraSetNearClipPlane(Scene.camera, min(ColCamDist-0.35f, 0.9f));
RwCameraSetNearClipPlane(Scene.camera, min(ColCamDist-0.35f, DEFAULT_NEAR));
}
}else{
Source = colPoint.point;
if(PedColDist < 0.9f + 0.3f)
if(PedColDist < DEFAULT_NEAR + 0.3f)
RwCameraSetNearClipPlane(Scene.camera, max(PedColDist-0.3f, 0.05f));
}
}
@ -1640,7 +1638,7 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient
CPed *player = FindPlayerPed();
float PlayerDist = (Source - player->GetPosition()).Magnitude();
if(PlayerDist < 2.75f)
Near = PlayerDist/2.75f * 0.9f - 0.3f;
Near = PlayerDist/2.75f * DEFAULT_NEAR - 0.3f;
RwCameraSetNearClipPlane(Scene.camera, max(Near, 0.1f));
}
}
@ -1800,11 +1798,11 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa
float zoomvalue = TheCamera.CarZoomValueSmooth;
if(zoomvalue < 0.1f)
zoomvalue = 0.1f;
if(TheCamera.CarZoomIndicator == 1.0f)
if(TheCamera.CarZoomIndicator == CAM_ZOOM_1)
ModeAlpha = CGeneral::GetATanOfXY(23.0f, zoomvalue); // near
else if(TheCamera.CarZoomIndicator == 2.0f)
else if(TheCamera.CarZoomIndicator == CAM_ZOOM_2)
ModeAlpha = CGeneral::GetATanOfXY(10.8f, zoomvalue); // mid
else if(TheCamera.CarZoomIndicator == 3.0f)
else if(TheCamera.CarZoomIndicator == CAM_ZOOM_3)
ModeAlpha = CGeneral::GetATanOfXY(7.0f, zoomvalue); // far
@ -1900,7 +1898,7 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa
PreviousNearCheckNearClipSmall = false;
if(!CamClear){
PreviousNearCheckNearClipSmall = true;
RwCameraSetNearClipPlane(Scene.camera, 0.9f);
RwCameraSetNearClipPlane(Scene.camera, DEFAULT_NEAR);
DeltaAlpha = TargetAlpha - (Alpha + ModeAlpha);
while(DeltaAlpha >= PI) DeltaAlpha -= 2*PI;
@ -1918,7 +1916,7 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa
if(CamClear)
if(CamZ - CamGround2 < 1.5f){
PreviousNearCheckNearClipSmall = true;
RwCameraSetNearClipPlane(Scene.camera, 0.9f);
RwCameraSetNearClipPlane(Scene.camera, DEFAULT_NEAR);
float a;
if(Length == 0.0f || CamGround2 + 1.5f - TargetCoors.z == 0.0f)
@ -1934,7 +1932,7 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa
float CamRoof2 = CWorld::FindRoofZFor3DCoord(Source.x, Source.y, CamZ, &FoundRoof);
if(FoundRoof && CamZ - CamRoof2 < 1.5f){
PreviousNearCheckNearClipSmall = true;
RwCameraSetNearClipPlane(Scene.camera, 0.9f);
RwCameraSetNearClipPlane(Scene.camera, DEFAULT_NEAR);
if(CamRoof2 > TargetCoors.z + 3.5f)
CamRoof2 = TargetCoors.z + 3.5f;
@ -1956,7 +1954,7 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa
LastAlphaSpeedStep = AlphaSpeedStep;
}else{
if(PreviousNearCheckNearClipSmall)
RwCameraSetNearClipPlane(Scene.camera, 0.9f);
RwCameraSetNearClipPlane(Scene.camera, DEFAULT_NEAR);
}
WellBufferMe(LastTargetAlphaWithCollisionOn, &Alpha, &AlphaSpeed, LastTopAlphaSpeed, LastAlphaSpeedStep, true);
@ -3204,7 +3202,8 @@ CCam::Process_BehindBoat(const CVector &CameraTarget, float TargetOrientation, f
static float WaterZAddition = 2.75f;
float WaterLevel = 0.0f;
float s, c;
float Beta = CGeneral::GetATanOfXY(TargetCoors.x - Source.x, TargetCoors.y - Source.y);
Beta = CGeneral::GetATanOfXY(TargetCoors.x - Source.x, TargetCoors.y - Source.y);
FOV = DefaultFOV;
if(ResetStatics){
@ -3717,7 +3716,7 @@ CCam::Process_Debug(const CVector&, float, float, float)
static float PanSpeedY = 0.0f;
CVector TargetCoors;
RwCameraSetNearClipPlane(Scene.camera, 0.9f);
RwCameraSetNearClipPlane(Scene.camera, DEFAULT_NEAR);
FOV = DefaultFOV;
Alpha += DEGTORAD(CPad::GetPad(1)->GetLeftStickY()) / 50.0f;
Beta += DEGTORAD(CPad::GetPad(1)->GetLeftStickX())*1.5f / 19.0f;
@ -3814,7 +3813,7 @@ CCam::Process_Debug(const CVector&, float, float, float)
static float Speed = 0.0f;
CVector TargetCoors;
RwCameraSetNearClipPlane(Scene.camera, 0.9f);
RwCameraSetNearClipPlane(Scene.camera, DEFAULT_NEAR);
FOV = DefaultFOV;
Alpha += DEGTORAD(CPad::GetPad(1)->GetLeftStickY()) / 50.0f;
Beta += DEGTORAD(CPad::GetPad(1)->GetLeftStickX())*1.5f / 19.0f;
@ -3887,7 +3886,7 @@ CCam::Process_Editor(const CVector&, float, float, float)
}
ResetStatics = false;
RwCameraSetNearClipPlane(Scene.camera, 0.9f);
RwCameraSetNearClipPlane(Scene.camera, DEFAULT_NEAR);
FOV = DefaultFOV;
Alpha += DEGTORAD(CPad::GetPad(1)->GetLeftStickY()) / 50.0f;
Beta += DEGTORAD(CPad::GetPad(1)->GetLeftStickX())*1.5f / 19.0f;
@ -4465,11 +4464,14 @@ CCam::Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrient
float MouseX = CPad::GetPad(0)->GetMouseX();
float MouseY = CPad::GetPad(0)->GetMouseY();
float LookLeftRight, LookUpDown;
if(bFreeMouseCam && (MouseX != 0.0f || MouseY != 0.0f) && !CPad::GetPad(0)->ArePlayerControlsDisabled()){
/*
if((MouseX != 0.0f || MouseY != 0.0f) && !CPad::GetPad(0)->ArePlayerControlsDisabled()){
UseMouse = true;
LookLeftRight = -2.5f*MouseX;
LookUpDown = 4.0f*MouseY;
}else{
}else
*/
{
LookLeftRight = -CPad::GetPad(0)->LookAroundLeftRight();
LookUpDown = CPad::GetPad(0)->LookAroundUpDown();
}
@ -4553,14 +4555,14 @@ CCam::Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrient
if(CWorld::ProcessLineOfSight(colPoint.point, Source, colPoint, entity, true, true, true, true, false, false, true)){
PedColDist = (TargetCoors - colPoint.point).Magnitude();
Source = colPoint.point;
if(PedColDist < 0.9f + 0.3f)
if(PedColDist < DEFAULT_NEAR + 0.3f)
RwCameraSetNearClipPlane(Scene.camera, max(PedColDist-0.3f, 0.05f));
}else{
RwCameraSetNearClipPlane(Scene.camera, min(ColCamDist-0.35f, 0.9f));
RwCameraSetNearClipPlane(Scene.camera, min(ColCamDist-0.35f, DEFAULT_NEAR));
}
}else{
Source = colPoint.point;
if(PedColDist < 0.9f + 0.3f)
if(PedColDist < DEFAULT_NEAR + 0.3f)
RwCameraSetNearClipPlane(Scene.camera, max(PedColDist-0.3f, 0.05f));
}
}
@ -4922,7 +4924,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
bool mouseChangesBeta = false;
// FIX: Disable mouse movement in drive-by, it's buggy. Original SA bug.
if (bFreeMouseCam && CCamera::m_bUseMouse3rdPerson && !pad->ArePlayerControlsDisabled() && nextDirectionIsForward) {
if (/*bFreeMouseCam &&*/ CCamera::m_bUseMouse3rdPerson && !pad->ArePlayerControlsDisabled() && nextDirectionIsForward) {
float mouseY = pad->GetMouseY() * 2.0f;
float mouseX = pad->GetMouseX() * -2.0f;
@ -5093,10 +5095,10 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
} else {
if (!CWorld::ProcessLineOfSight(foundCol.point, Source, foundCol, foundEnt, true, dontCollideWithCars < 0.1f, false, true, false, true, false)) {
float lessClip = obstacleCamDist - 0.35f;
if (lessClip <= 0.9f)
if (lessClip <= DEFAULT_NEAR)
RwCameraSetNearClipPlane(Scene.camera, lessClip);
else
RwCameraSetNearClipPlane(Scene.camera, 0.9f);
RwCameraSetNearClipPlane(Scene.camera, DEFAULT_NEAR);
} else {
obstacleTargetDist = (TargetCoors - foundCol.point).Magnitude();
Source = foundCol.point;
@ -5238,9 +5240,6 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
#endif
STARTPATCHES
#ifdef FREE_CAM
Nop(0x468E7B, 0x468E90-0x468E7B); // disable first person
#endif
InjectHook(0x456F40, WellBufferMe, PATCH_JUMP);
InjectHook(0x458410, &CCam::Init, PATCH_JUMP);
InjectHook(0x4582F0, &CCam::GetVectorsReadyForRW, PATCH_JUMP);
@ -5290,6 +5289,4 @@ STARTPATCHES
InjectHook(0x456CE0, &FindSplinePathPositionFloat, PATCH_JUMP);
InjectHook(0x4569A0, &FindSplinePathPositionVector, PATCH_JUMP);
InjectHook(0x473250, &CCamera::dtor, PATCH_JUMP);
ENDPATCHES

File diff suppressed because it is too large Load Diff

View File

@ -4,13 +4,28 @@
class CEntity;
class CPed;
class CAutomobile;
class CGarage;
extern int16 &DebugCamMode;
#define NUMBER_OF_VECTORS_FOR_AVERAGE 2
struct CCam
enum
{
NUMBER_OF_VECTORS_FOR_AVERAGE = 2,
MAX_NUM_OF_SPLINETYPES = 4,
MAX_NUM_OF_NODES = 800 // for trains
};
#define DEFAULT_NEAR (0.9f)
#define CAM_ZOOM_1STPRS (0.0f)
#define CAM_ZOOM_1 (1.0f)
#define CAM_ZOOM_2 (2.0f)
#define CAM_ZOOM_3 (3.0f)
#define CAM_ZOOM_TOPDOWN (4.0f)
#define CAM_ZOOM_CINEMATIC (5.0f)
class CCam
{
public:
enum
{
MODE_NONE = 0,
@ -230,9 +245,12 @@ static_assert(sizeof(CCam) == 0x1A4, "CCam: wrong size");
static_assert(offsetof(CCam, Alpha) == 0xA8, "CCam: error");
static_assert(offsetof(CCam, Front) == 0x140, "CCam: error");
struct CCamPathSplines
class CCamPathSplines
{
float m_arr_PathData[800];
public:
enum {MAXPATHLENGTH=800};
float m_arr_PathData[MAXPATHLENGTH];
CCamPathSplines(void);
};
struct CTrainCamNode
@ -296,13 +314,14 @@ enum
enum
{
CAM_CONTROLLER_0,
CAM_CONTROLLER_1,
CAM_CONTROLLER_2
CAMCONTROL_GAME,
CAMCONTROL_SCRIPT,
CAMCONTROL_OBBE
};
struct CCamera : public CPlaceable
class CCamera : public CPlaceable
{
public:
bool m_bAboveGroundTrainNodesLoaded;
bool m_bBelowGroundTrainNodesLoaded;
bool m_bCamDirectlyBehind;
@ -344,16 +363,12 @@ struct CCamera : public CPlaceable
bool m_bHeadBob;
bool m_bFailedCullZoneTestPreviously;
bool m_FadeTargetIsSplashScreen;
bool m_FadeTargetIsSplashScreen;
bool WorldViewerBeingUsed;
uint8 ActiveCam;
uint32 m_uiCamShakeStart;
uint32 m_uiFirstPersonCamLastInputTime;
// where are those?
//bool m_bVehicleSuspenHigh;
//bool m_bEnable1rstPersonCamCntrlsScript;
//bool m_bAllow1rstPersonWeaponsCamera;
uint32 m_uiLongestTimeInMill;
uint32 m_uiNumberOfTrainCamNodes;
@ -369,7 +384,7 @@ bool m_FadeTargetIsSplashScreen;
int m_BlurRed;
int m_BlurType;
uint32 unknown;
uint32 unknown; // some counter having to do with music
int m_iWorkOutSpeedThisNumFrames;
int m_iNumFramesSoFar;
@ -412,20 +427,20 @@ uint32 unknown;
float m_fOldBetaDiff;
float m_fPedZoomValue;
float m_fPedZoomValueScript;
float m_fPedZoomValueSmooth;
float m_fPositionAlongSpline;
float m_ScreenReductionPercentage;
float m_ScreenReductionSpeed;
float m_AlphaForPlayerAnim1rstPerson;
float Orientation;
float PedZoomIndicator;
float PlayerExhaustion;
float SoundDistUp, SoundDistLeft, SoundDistRight;
float SoundDistUpAsRead, SoundDistLeftAsRead, SoundDistRightAsRead;
float SoundDistUpAsReadOld, SoundDistLeftAsReadOld, SoundDistRightAsReadOld;
float m_fWideScreenReductionAmount;
float m_fStartingFOVForInterPol;
float m_fPedZoomValueScript;
float m_fPedZoomValueSmooth;
float m_fPositionAlongSpline;
float m_ScreenReductionPercentage;
float m_ScreenReductionSpeed;
float m_AlphaForPlayerAnim1rstPerson;
float Orientation;
float PedZoomIndicator;
float PlayerExhaustion;
float SoundDistUp, SoundDistLeft, SoundDistRight;
float SoundDistUpAsRead, SoundDistLeftAsRead, SoundDistRightAsRead;
float SoundDistUpAsReadOld, SoundDistLeftAsReadOld, SoundDistRightAsReadOld;
float m_fWideScreenReductionAmount;
float m_fStartingFOVForInterPol;
// not static yet
float m_fMouseAccelHorzntl;// acceleration multiplier for 1st person controls
@ -435,8 +450,8 @@ uint32 unknown;
CCam Cams[3];
void *pToGarageWeAreIn;
void *pToGarageWeAreInForHackAvoidFirstPerson;
CGarage *pToGarageWeAreIn;
CGarage *pToGarageWeAreInForHackAvoidFirstPerson;
CQueuedMode m_PlayerMode;
CQueuedMode PlayerWeaponMode;
CVector m_PreviousCameraPosition;
@ -447,17 +462,15 @@ uint32 unknown;
CVector m_vecFixedModeUpOffSet;
CVector m_vecCutSceneOffset;
// one of those has to go
CVector m_cvecStartingSourceForInterPol;
CVector m_cvecStartingTargetForInterPol;
CVector m_cvecStartingUpForInterPol;
CVector m_cvecSourceSpeedAtStartInter;
CVector m_cvecTargetSpeedAtStartInter;
CVector m_cvecUpSpeedAtStartInter;
CVector m_vecSourceWhenInterPol;
CVector m_vecTargetWhenInterPol;
CVector m_vecUpWhenInterPol;
//CVector m_vecClearGeometryVec;
CVector m_cvecStartingSourceForInterPol;
CVector m_cvecStartingTargetForInterPol;
CVector m_cvecStartingUpForInterPol;
CVector m_cvecSourceSpeedAtStartInter;
CVector m_cvecTargetSpeedAtStartInter;
CVector m_cvecUpSpeedAtStartInter;
CVector m_vecSourceWhenInterPol;
CVector m_vecTargetWhenInterPol;
CVector m_vecUpWhenInterPol;
CVector m_vecGameCamPos;
CVector SourceDuringInter;
@ -465,8 +478,8 @@ uint32 unknown;
CVector UpDuringInter;
RwCamera *m_pRwCamera;
CEntity *pTargetEntity;
CCamPathSplines m_arrPathArray[4];
CTrainCamNode m_arrTrainCamNode[800];
CCamPathSplines m_arrPathArray[MAX_NUM_OF_SPLINETYPES];
CTrainCamNode m_arrTrainCamNode[MAX_NUM_OF_NODES];
CMatrix m_cameraMatrix;
bool m_bGarageFixedCamPositionSet;
bool m_vecDoingSpecialInterPolation;
@ -490,7 +503,7 @@ uint32 unknown;
float m_fScriptPercentageInterToStopMoving;
float m_fScriptPercentageInterToCatchUp;
uint32 m_fScriptTimeForInterPolation;
uint32 m_fScriptTimeForInterPolation;
int16 m_iFadingDirection;
@ -503,68 +516,97 @@ uint32 m_fScriptTimeForInterPolation;
uint32 m_uiFadeTimeStartedMusic;
static bool &m_bUseMouse3rdPerson;
#ifdef FREE_CAM
static bool bFreeCam;
#endif
// High level and misc
void Init(void);
void Process(void);
void CamControl(void);
void UpdateTargetEntity(void);
void UpdateSoundDistances(void);
void InitialiseCameraForDebugMode(void);
void CamShake(float strength, float x, float y, float z);
bool Get_Just_Switched_Status() { return m_bJust_Switched; }
inline const CMatrix& GetCameraMatrix(void) { return m_cameraMatrix; }
CVector &GetGameCamPosition(void) { return m_vecGameCamPos; }
// Who's in control
void TakeControl(CEntity *target, int16 mode, int16 typeOfSwitch, int32 controller);
void TakeControlNoEntity(const CVector &position, int16 typeOfSwitch, int32 controller);
void TakeControlWithSpline(int16 typeOfSwitch);
void Restore(void);
void RestoreWithJumpCut(void);
void SetCamPositionForFixedMode(const CVector &Source, const CVector &UppOffSet);
// Transition
void StartTransition(int16 mode);
void StartTransitionWhenNotFinishedInter(int16 mode);
void StoreValuesDuringInterPol(CVector &source, CVector &target, CVector &up, float &FOV);
// Widescreen borders
void SetWideScreenOn(void);
void SetWideScreenOff(void);
void ProcessWideScreenOn(void);
void DrawBordersForWideScreen(void);
// Obbe's cam
bool IsItTimeForNewcam(int32 obbeMode, int32 time);
bool TryToStartNewCamMode(int32 obbeMode);
void DontProcessObbeCinemaCamera(void);
void ProcessObbeCinemaCameraCar(void);
void ProcessObbeCinemaCameraPed(void);
// Train
void LoadTrainCamNodes(char const *name);
void Process_Train_Camera_Control(void);
// Script
void LoadPathSplines(int file);
void FinishCutscene(void);
float GetPositionAlongSpline(void) { return m_fPositionAlongSpline; }
uint32 GetCutSceneFinishTime(void);
void SetCamCutSceneOffSet(const CVector &pos);
void SetPercentAlongCutScene(float percent);
void SetParametersForScriptInterpolation(float stopMoving, float catchUp, int32 time);
void SetZoomValueFollowPedScript(int16 dist);
void SetZoomValueCamStringScript(int16 dist);
void SetNearClipScript(float);
// Fading
void ProcessFade(void);
void ProcessMusicFade(void);
void Fade(float timeout, int16 direction);
void SetFadeColour(uint8 r, uint8 g, uint8 b);
bool GetFading(void);
int GetFadingDirection(void);
int GetScreenFadeStatus(void);
// Motion blur
void RenderMotionBlur(void);
void SetMotionBlur(int r, int g, int b, int a, int type);
void SetMotionBlurAlpha(int a);
// Player looking and aiming
int GetLookDirection(void);
bool GetLookingForwardFirstPerson(void);
bool GetLookingLRBFirstPerson(void);
void SetCameraDirectlyInFrontForFollowPed_CamOnAString(void);
void SetCameraDirectlyBehindForFollowPed_CamOnAString(void);
void SetNewPlayerWeaponMode(int16 mode, int16 minZoom, int16 maxZoom);
void ClearPlayerWeaponMode(void);
void UpdateAimingCoors(CVector const &coors);
void Find3rdPersonCamTargetVector(float dist, CVector pos, CVector &source, CVector &target);
float Find3rdPersonQuickAimPitch(void);
// Physical camera
void SetRwCamera(RwCamera *cam);
const CMatrix& GetCameraMatrix(void) { return m_cameraMatrix; }
CVector &GetGameCamPosition(void) { return m_vecGameCamPos; }
void CalculateDerivedValues(void);
bool IsPointVisible(const CVector &center, const CMatrix *mat);
bool IsSphereVisible(const CVector &center, float radius, const CMatrix *mat);
bool IsSphereVisible(const CVector &center, float radius);
bool IsBoxVisible(RwV3d *box, const CMatrix *mat);
int GetLookDirection(void);
bool GetLookingForwardFirstPerson(void);
void Fade(float timeout, int16 direction);
int GetScreenFadeStatus(void);
void ProcessFade(void);
void ProcessMusicFade(void);
void SetFadeColour(uint8 r, uint8 g, uint8 b);
void CamShake(float strength, float x, float y, float z);
void SetMotionBlur(int r, int g, int b, int a, int type);
void SetMotionBlurAlpha(int a);
void RenderMotionBlur(void);
void ClearPlayerWeaponMode();
void CalculateDerivedValues(void);
void DrawBordersForWideScreen(void);
void Restore(void);
void SetWideScreenOn(void);
void SetWideScreenOff(void);
void SetNearClipScript(float);
float Find3rdPersonQuickAimPitch(void);
void TakeControl(CEntity*, int16, int16, int32);
void TakeControlNoEntity(const CVector&, int16, int32);
void SetCamPositionForFixedMode(const CVector&, const CVector&);
bool GetFading();
int GetFadingDirection();
void Init();
void SetRwCamera(RwCamera*);
void Process();
void LoadPathSplines(int file);
uint32 GetCutSceneFinishTime(void);
void FinishCutscene(void);
void SetCamCutSceneOffSet(const CVector&);
void TakeControlWithSpline(short);
void RestoreWithJumpCut(void);
void SetCameraDirectlyInFrontForFollowPed_CamOnAString(void);
void SetCameraDirectlyBehindForFollowPed_CamOnAString(void);
void SetZoomValueFollowPedScript(int16);
void SetZoomValueCamStringScript(int16);
void SetNewPlayerWeaponMode(int16, int16, int16);
void UpdateAimingCoors(CVector const &);
void SetPercentAlongCutScene(float);
void SetParametersForScriptInterpolation(float, float, int32);
void dtor(void) { this->CCamera::~CCamera(); }
};
static_assert(offsetof(CCamera, DistanceToWater) == 0xe4, "CCamera: error");
static_assert(offsetof(CCamera, m_WideScreenOn) == 0x70, "CCamera: error");
@ -583,3 +625,5 @@ static_assert(sizeof(CCamera) == 0xE9D8, "CCamera: wrong size");
extern CCamera &TheCamera;
void CamShakeNoPos(CCamera*, float);
void MakeAngleLessThan180(float &Angle);
void WellBufferMe(float Target, float *CurrentValue, float *CurrentSpeed, float MaxSpeed, float Acceleration, bool IsAngle);

View File

@ -29,6 +29,7 @@ public:
static void SetRunning(bool running) { ms_running = running; }
static bool IsRunning(void) { return ms_running; }
static bool IsCutsceneProcessing(void) { return ms_cutsceneProcessing; }
static bool UseLodMultiplier(void) { return ms_useLodMultiplier; }
static CCutsceneObject* GetCutsceneObject(int id) { return ms_pCutsceneObjects[id]; }
static int GetCutsceneTimeInMilleseconds(void) { return 1000.0f * ms_cutsceneTimer; }
static char *GetCutsceneName(void) { return ms_cutsceneName; }

View File

@ -529,7 +529,7 @@ WRAPPER void CMenuManager::DoSettingsBeforeStartingAGame() { EAXJMP(0x48AB40); }
#else
void CMenuManager::DoSettingsBeforeStartingAGame()
{
CCamera::m_bUseMouse3rdPerson = m_ControlMethod == CONTROL_STANDART;
CCamera::m_bUseMouse3rdPerson = m_ControlMethod == CONTROL_STANDARD;
if (m_PrefsVsyncDisp != m_PrefsVsync)
m_PrefsVsync = m_PrefsVsyncDisp;
@ -2072,7 +2072,7 @@ void CMenuManager::Process(void)
}
if (m_nCurrScreen == MENUPAGE_LOADING_IN_PROGRESS) {
if (CheckSlotDataValid(m_nCurrSaveSlot)) {
TheCamera.m_bUseMouse3rdPerson = m_ControlMethod == CONTROL_STANDART;
TheCamera.m_bUseMouse3rdPerson = m_ControlMethod == CONTROL_STANDARD;
if (m_PrefsVsyncDisp != m_PrefsVsync)
m_PrefsVsync = m_PrefsVsyncDisp;
DMAudio.Service();
@ -3175,7 +3175,7 @@ CMenuManager::ProcessButtonPresses(void)
PSGLOBAL(joy1)->GetCapabilities(&devCaps);
ControlsManager.InitDefaultControlConfigJoyPad(devCaps.dwButtons);
}
CMenuManager::m_ControlMethod = CONTROL_STANDART;
CMenuManager::m_ControlMethod = CONTROL_STANDARD;
MousePointerStateHelper.bInvertVertically = false;
TheCamera.m_fMouseAccelHorzntl = 0.0025f;
CVehicle::m_bDisableMouseSteering = true;
@ -3188,7 +3188,7 @@ CMenuManager::ProcessButtonPresses(void)
#ifndef TIDY_UP_PBP
if (CMenuManager::m_ControlMethod == CONTROL_CLASSIC) {
CCamera::m_bUseMouse3rdPerson = true;
CMenuManager::m_ControlMethod = CONTROL_STANDART;
CMenuManager::m_ControlMethod = CONTROL_STANDARD;
} else {
CCamera::m_bUseMouse3rdPerson = false;
CMenuManager::m_ControlMethod = CONTROL_CLASSIC;

View File

@ -365,7 +365,7 @@ enum
enum eControlMethod
{
CONTROL_STANDART = 0,
CONTROL_STANDARD = 0,
CONTROL_CLASSIC,
};

View File

@ -2,7 +2,7 @@
enum {
PLAYERCONTROL_ENABLED = 0,
PLAYERCONTROL_DISABLED_1 = 1,
PLAYERCONTROL_DISABLED_1 = 1, // used by first person camera
PLAYERCONTROL_DISABLED_2 = 2,
PLAYERCONTROL_GARAGE = 4,
PLAYERCONTROL_DISABLED_8 = 8,

View File

@ -215,4 +215,4 @@ enum Config {
// Camera
#define IMPROVED_CAMERA // Better Debug cam, and maybe more in the future
//#define FREE_CAM // Rotating cam
#define FREE_CAM // Rotating cam

View File

@ -372,11 +372,9 @@ DebugMenuPopulate(void)
extern bool PrintDebugCode;
extern int16 &DebugCamMode;
DebugMenuAddVarBool8("Cam", "Use mouse Cam", (int8*)&CCamera::m_bUseMouse3rdPerson, nil);
#ifdef FREE_CAM
extern bool bFreePadCam;
extern bool bFreeMouseCam;
DebugMenuAddVarBool8("Cam", "Free Gamepad Cam", (int8*)&bFreePadCam, nil);
DebugMenuAddVarBool8("Cam", "Free Mouse Cam", (int8*)&bFreeMouseCam, nil);
DebugMenuAddVarBool8("Cam", "Free Cam", (int8*)&CCamera::bFreeCam, nil);
#endif
DebugMenuAddVarBool8("Cam", "Print Debug Code", (int8*)&PrintDebugCode, nil);
DebugMenuAddVar("Cam", "Cam Mode", &DebugCamMode, nil, 1, 0, CCam::MODE_EDITOR, nil);

View File

@ -59,10 +59,6 @@
#define CAN_SEE_ENTITY_ANGLE_THRESHOLD DEGTORAD(60.0f)
#ifdef FREE_CAM
extern bool bFreeMouseCam;
#endif
CPed *gapTempPedList[50];
uint16 gnNumTempPedList;
@ -812,7 +808,7 @@ bool
CPed::CanStrafeOrMouseControl(void)
{
#ifdef FREE_CAM
if (bFreeMouseCam)
if (CCamera::bFreeCam)
return false;
#endif
return m_nPedState == PED_NONE || m_nPedState == PED_IDLE || m_nPedState == PED_FLEE_POS || m_nPedState == PED_FLEE_ENTITY ||
@ -6993,7 +6989,7 @@ CPed::FinishLaunchCB(CAnimBlendAssociation *animAssoc, void *arg)
) {
#ifdef FREE_CAM
if (TheCamera.Cams[0].Using3rdPersonMouseCam() && !bFreeMouseCam) {
if (TheCamera.Cams[0].Using3rdPersonMouseCam() && !CCamera::bFreeCam) {
#else
if (TheCamera.Cams[0].Using3rdPersonMouseCam()) {
#endif

View File

@ -18,10 +18,6 @@
#define PAD_MOVE_TO_GAME_WORLD_MOVE 60.0f
#ifdef FREE_CAM
extern bool bFreeMouseCam;
#endif
CPlayerPed::~CPlayerPed()
{
delete m_pWanted;
@ -693,7 +689,7 @@ CPlayerPed::PlayerControl1stPersonRunAround(CPad *padUsed)
float padMoveInGameUnit = padMove / PAD_MOVE_TO_GAME_WORLD_MOVE;
if (padMoveInGameUnit > 0.0f) {
#ifdef FREE_CAM
if (!bFreeMouseCam)
if (!CCamera::bFreeCam)
m_fRotationDest = CGeneral::LimitRadianAngle(TheCamera.Orientation);
else
m_fRotationDest = CGeneral::GetRadianAngleBetweenPoints(0.0f, 0.0f, -leftRight, upDown) - TheCamera.Orientation;
@ -993,7 +989,7 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
SetStoredState();
m_nPedState = PED_SNIPER_MODE;
#ifdef FREE_CAM
if (bFreeMouseCam && TheCamera.Cams[0].Using3rdPersonMouseCam()) {
if (CCamera::bFreeCam && TheCamera.Cams[0].Using3rdPersonMouseCam()) {
m_fRotationCur = CGeneral::LimitRadianAngle(-TheCamera.Orientation);
SetHeading(m_fRotationCur);
}
@ -1018,7 +1014,7 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
if (m_nSelectedWepSlot == m_currentWeapon) {
if (m_pPointGunAt) {
#ifdef FREE_CAM
if (bFreeMouseCam && weaponInfo->m_eWeaponFire == WEAPON_FIRE_MELEE && m_fMoveSpeed < 1.0f)
if (CCamera::bFreeCam && weaponInfo->m_eWeaponFire == WEAPON_FIRE_MELEE && m_fMoveSpeed < 1.0f)
StartFightAttack(padUsed->GetWeapon());
else
#endif
@ -1052,7 +1048,7 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
#ifdef FREE_CAM
// Rotate player/arm when shooting. We don't have auto-rotation anymore
if (CCamera::m_bUseMouse3rdPerson && bFreeMouseCam &&
if (CCamera::m_bUseMouse3rdPerson && CCamera::bFreeCam &&
m_nSelectedWepSlot == m_currentWeapon && m_nMoveState != PEDMOVE_SPRINT) {
// Weapons except throwable and melee ones
@ -1103,7 +1099,7 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
// what??
if (!m_pPointGunAt
#ifdef FREE_CAM
|| (!bFreeMouseCam && CCamera::m_bUseMouse3rdPerson)
|| (!CCamera::bFreeCam && CCamera::m_bUseMouse3rdPerson)
#else
|| CCamera::m_bUseMouse3rdPerson
#endif
@ -1125,7 +1121,7 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
TheCamera.UpdateAimingCoors(m_pPointGunAt->GetPosition());
}
#ifdef FREE_CAM
else if ((bFreeMouseCam && weaponInfo->m_eWeaponFire == WEAPON_FIRE_MELEE) || (weaponInfo->m_bCanAim && !CCamera::m_bUseMouse3rdPerson)) {
else if ((CCamera::bFreeCam && weaponInfo->m_eWeaponFire == WEAPON_FIRE_MELEE) || (weaponInfo->m_bCanAim && !CCamera::m_bUseMouse3rdPerson)) {
#else
else if (weaponInfo->m_bCanAim && !CCamera::m_bUseMouse3rdPerson) {
#endif

View File

@ -2340,8 +2340,7 @@ CAutomobile::FireTruckControl(void)
if(!CPad::GetPad(0)->GetWeapon())
return;
#ifdef FREE_CAM
extern bool bFreeMouseCam;
if (!bFreeMouseCam)
if (!CCamera::bFreeCam)
#endif
{
m_fCarGunLR += CPad::GetPad(0)->GetCarGunLeftRight() * 0.00025f * CTimer::GetTimeStep();
@ -2416,8 +2415,7 @@ CAutomobile::TankControl(void)
// Rotate turret
float prevAngle = m_fCarGunLR;
#ifdef FREE_CAM
extern bool bFreeMouseCam;
if(!bFreeMouseCam)
if(!CCamera::bFreeCam)
#endif
m_fCarGunLR -= CPad::GetPad(0)->GetCarGunLeftRight() * 0.00015f * CTimer::GetTimeStep();