re3/src/core/Camera.h

644 lines
19 KiB
C
Raw Normal View History

2019-05-15 14:52:37 +00:00
#pragma once
#include "Placeable.h"
class CEntity;
class CPed;
class CAutomobile;
2020-04-02 10:48:01 +00:00
class CGarage;
2019-05-15 14:52:37 +00:00
2020-04-17 05:54:14 +00:00
extern int16 DebugCamMode;
2020-03-26 13:16:06 +00:00
2020-04-02 10:48:01 +00:00
enum
{
NUMBER_OF_VECTORS_FOR_AVERAGE = 2,
MAX_NUM_OF_SPLINETYPES = 4,
MAX_NUM_OF_NODES = 800 // for trains
};
#define DEFAULT_NEAR (0.9f)
2020-04-08 06:58:08 +00:00
enum
{
CAM_ZOOM_1STPRS,
CAM_ZOOM_1,
CAM_ZOOM_2,
CAM_ZOOM_3,
CAM_ZOOM_TOPDOWN,
CAM_ZOOM_CINEMATIC,
};
2019-05-15 14:52:37 +00:00
2020-05-08 23:50:48 +00:00
const float DefaultFOV = 70.0f; // beta: 80.0f
2020-04-02 10:48:01 +00:00
class CCam
2019-05-15 14:52:37 +00:00
{
2020-04-02 10:48:01 +00:00
public:
enum
2019-05-15 14:52:37 +00:00
{
2019-10-27 03:17:30 +00:00
MODE_NONE = 0,
MODE_TOPDOWN,
MODE_GTACLASSIC,
2019-05-15 14:52:37 +00:00
MODE_BEHINDCAR,
MODE_FOLLOWPED,
MODE_AIMING,
MODE_DEBUG,
MODE_SNIPER,
2019-10-27 03:17:30 +00:00
MODE_ROCKETLAUNCHER,
2019-05-15 14:52:37 +00:00
MODE_MODELVIEW,
MODE_BILL,
MODE_SYPHON,
MODE_CIRCLE,
MODE_CHEESYZOOM,
MODE_WHEELCAM,
MODE_FIXED,
2019-10-27 03:17:30 +00:00
MODE_1STPERSON,
2019-05-15 14:52:37 +00:00
MODE_FLYBY,
2019-10-27 03:17:30 +00:00
MODE_CAM_ON_A_STRING,
MODE_REACTION,
MODE_FOLLOW_PED_WITH_BIND,
MODE_CHRIS,
2019-05-15 14:52:37 +00:00
MODE_BEHINDBOAT,
2019-10-27 03:17:30 +00:00
MODE_PLAYER_FALLEN_WATER,
MODE_CAM_ON_TRAIN_ROOF,
MODE_CAM_RUNNING_SIDE_TRAIN,
MODE_BLOOD_ON_THE_TRACKS,
MODE_IM_THE_PASSENGER_WOOWOO,
MODE_SYPHON_CRIM_IN_FRONT,
MODE_PED_DEAD_BABY,
MODE_PILLOWS_PAPS,
MODE_LOOK_AT_CARS,
MODE_ARRESTCAM_ONE,
MODE_ARRESTCAM_TWO,
MODE_M16_1STPERSON,
MODE_SPECIAL_FIXED_FOR_SYPHON,
MODE_FIGHT_CAM,
MODE_TOP_DOWN_PED,
MODE_LIGHTHOUSE,
2019-10-27 03:17:30 +00:00
MODE_SNIPER_RUNABOUT,
MODE_ROCKETLAUNCHER_RUNABOUT,
MODE_1STPERSON_RUNABOUT,
MODE_M16_1STPERSON_RUNABOUT,
MODE_FIGHT_CAM_RUNABOUT,
2019-05-15 14:52:37 +00:00
MODE_EDITOR,
2020-05-24 13:14:27 +00:00
MODE_HELICANNON_1STPERSON,
MODE_CAMERA,
2019-05-15 14:52:37 +00:00
};
bool bBelowMinDist; //used for follow ped mode
bool bBehindPlayerDesired; //used for follow ped mode
bool m_bCamLookingAtVector;
bool m_bCollisionChecksOn;
bool m_bFixingBeta; //used for camera on a string
bool m_bTheHeightFixerVehicleIsATrain;
bool LookBehindCamWasInFront;
bool LookingBehind;
2020-03-26 13:16:06 +00:00
bool LookingLeft;
2019-05-15 14:52:37 +00:00
bool LookingRight;
bool ResetStatics; //for interpolation type stuff to work
bool Rotating;
int16 Mode; // CameraMode
2020-03-26 13:16:06 +00:00
uint32 m_uiFinishTime;
2019-05-15 14:52:37 +00:00
int m_iDoCollisionChecksOnFrameNum;
int m_iDoCollisionCheckEveryNumOfFrames;
2020-03-26 13:16:06 +00:00
int m_iFrameNumWereAt;
2019-05-15 14:52:37 +00:00
int m_iRunningVectorArrayPos;
int m_iRunningVectorCounter;
int DirectionWasLooking;
float f_max_role_angle; //=DEGTORAD(5.0f);
float f_Roll; //used for adding a slight roll to the camera in the
2020-06-14 21:15:56 +00:00
float f_rollSpeed;
2019-05-15 14:52:37 +00:00
float m_fSyphonModeTargetZOffSet;
float m_fAmountFractionObscured;
2020-03-26 13:16:06 +00:00
float m_fAlphaSpeedOverOneFrame;
2019-05-15 14:52:37 +00:00
float m_fBetaSpeedOverOneFrame;
float m_fBufferedTargetBeta;
float m_fBufferedTargetOrientation;
float m_fBufferedTargetOrientationSpeed;
float m_fCamBufferedHeight;
float m_fCamBufferedHeightSpeed;
float m_fCloseInPedHeightOffset;
2020-03-26 13:16:06 +00:00
float m_fCloseInPedHeightOffsetSpeed;
2019-05-15 14:52:37 +00:00
float m_fCloseInCarHeightOffset;
float m_fCloseInCarHeightOffsetSpeed;
float m_fDimensionOfHighestNearCar;
float m_fDistanceBeforeChanges;
float m_fFovSpeedOverOneFrame;
float m_fMinDistAwayFromCamWhenInterPolating;
float m_fPedBetweenCameraHeightOffset;
2020-03-26 13:16:06 +00:00
float m_fPlayerInFrontSyphonAngleOffSet;
2019-05-15 14:52:37 +00:00
float m_fRadiusForDead;
float m_fRealGroundDist; //used for follow ped mode
float m_fTargetBeta;
float m_fTimeElapsedFloat;
2020-06-09 13:50:00 +00:00
float m_fTilt;
float m_fTiltSpeed;
2019-05-15 14:52:37 +00:00
float m_fTransitionBeta;
float m_fTrueBeta;
2020-03-26 13:16:06 +00:00
float m_fTrueAlpha;
2019-05-15 14:52:37 +00:00
float m_fInitialPlayerOrientation; //used for first person
float Alpha;
float AlphaSpeed;
float FOV;
float FOVSpeed;
float Beta;
float BetaSpeed;
2020-03-26 13:16:06 +00:00
float Distance;
2019-05-15 14:52:37 +00:00
float DistanceSpeed;
float CA_MIN_DISTANCE;
float CA_MAX_DISTANCE;
float SpeedVar;
2020-06-09 13:50:00 +00:00
float m_fTargetZoomGroundOne;
float m_fTargetZoomGroundTwo;
float m_fTargetZoomGroundThree;
float m_fTargetZoomOneZExtra;
float m_fTargetZoomTwoZExtra;
float m_fTargetZoomThreeZExtra;
float m_fTargetZoomZCloseIn;
float m_fMinRealGroundDist;
float m_fTargetCloseInDist;
2020-03-26 13:16:06 +00:00
CVector m_cvecSourceSpeedOverOneFrame;
CVector m_cvecTargetSpeedOverOneFrame;
CVector m_cvecUpOverOneFrame;
CVector m_cvecTargetCoorsForFudgeInter;
CVector m_cvecCamFixedModeVector;
CVector m_cvecCamFixedModeSource;
CVector m_cvecCamFixedModeUpOffSet;
CVector m_vecLastAboveWaterCamPosition; //helper for when the player has gone under the water
CVector m_vecBufferedPlayerBodyOffset;
2019-05-15 14:52:37 +00:00
// The three vectors that determine this camera for this frame
2020-03-26 13:16:06 +00:00
CVector Front; // Direction of looking in
2019-05-15 14:52:37 +00:00
CVector Source; // Coors in world space
CVector SourceBeforeLookBehind;
CVector Up; // Just that
CVector m_arrPreviousVectors[NUMBER_OF_VECTORS_FOR_AVERAGE]; // used to average stuff
CEntity *CamTargetEntity;
float m_fCameraDistance;
float m_fIdealAlpha;
float m_fPlayerVelocity;
CAutomobile *m_pLastCarEntered; // So interpolation works
CPed *m_pLastPedLookedAt;// So interpolation works
bool m_bFirstPersonRunAboutActive;
2020-03-26 13:16:06 +00:00
CCam(void) { Init(); }
void Init(void);
void Process(void);
void ProcessSpecialHeightRoutines(void);
2019-05-15 14:52:37 +00:00
void GetVectorsReadyForRW(void);
CVector DoAverageOnVector(const CVector &vec);
void WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, float TargetHeight);
bool RotCamIfInFrontCar(CVector &TargetCoors, float TargetOrientation);
void Cam_On_A_String_Unobscured(const CVector &TargetCoors, float BaseDist);
void FixCamWhenObscuredByVehicle(const CVector &TargetCoors);
2020-06-15 18:50:01 +00:00
bool GetBoatLook_L_R_HeightOffset(float &Offset);
2020-03-26 13:16:06 +00:00
void LookBehind(void);
void LookLeft(void);
void LookRight(void);
void ClipIfPedInFrontOfPlayer(void);
void KeepTrackOfTheSpeed(const CVector &source, const CVector &target, const CVector &up, const float &alpha, const float &beta, const float &fov);
bool Using3rdPersonMouseCam(void);
bool GetWeaponFirstPersonOn(void);
bool IsTargetInWater(const CVector &CamCoors);
void AvoidWallsTopDownPed(const CVector &TargetCoors, const CVector &Offset, float *Adjuster, float *AdjusterSpeed, float yDistLimit);
void PrintMode(void);
void Process_Debug(const CVector&, float, float, float);
void Process_Editor(const CVector&, float, float, float);
void Process_ModelView(const CVector &CameraTarget, float, float, float);
void Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, float, float);
2020-03-26 13:16:06 +00:00
void Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrientation, float, float);
void Process_BehindCar(const CVector &CameraTarget, float TargetOrientation, float, float);
void Process_Cam_On_A_String(const CVector &CameraTarget, float TargetOrientation, float, float);
2020-03-26 13:16:06 +00:00
void Process_TopDown(const CVector &CameraTarget, float TargetOrientation, float SpeedVar, float TargetSpeedVar);
void Process_TopDownPed(const CVector &CameraTarget, float TargetOrientation, float, float);
void Process_Rocket(const CVector &CameraTarget, float, float, float);
void Process_M16_1stPerson(const CVector &CameraTarget, float, float, float);
void Process_1stPerson(const CVector &CameraTarget, float, float, float);
void Process_1rstPersonPedOnPC(const CVector &CameraTarget, float TargetOrientation, float, float);
void Process_Sniper(const CVector &CameraTarget, float, float, float);
void Process_Syphon(const CVector &CameraTarget, float, float, float);
void Process_Syphon_Crim_In_Front(const CVector &CameraTarget, float, float, float);
void Process_BehindBoat(const CVector &CameraTarget, float TargetOrientation, float, float);
void Process_Fight_Cam(const CVector &CameraTarget, float TargetOrientation, float, float);
void Process_FlyBy(const CVector&, float, float, float);
2020-06-09 13:50:00 +00:00
bool Process_WheelCam(const CVector&, float, float, float);
2020-03-26 13:16:06 +00:00
void Process_Fixed(const CVector &CameraTarget, float, float, float);
void Process_Player_Fallen_Water(const CVector &CameraTarget, float TargetOrientation, float, float);
void Process_SpecialFixedForSyphon(const CVector &CameraTarget, float, float, float);
2020-06-14 21:15:56 +00:00
void Process_LightHouse(const CVector &CameraTarget, float, float, float);
2020-03-26 13:16:06 +00:00
void ProcessPedsDeadBaby(void);
bool ProcessArrestCamOne(void);
bool ProcessArrestCamTwo(void);
2020-06-14 21:15:56 +00:00
bool GetLookAlongGroundPos(CEntity *Target, CPed *Cop, CVector &TargetCoors, CVector &SourceOut);
bool GetLookFromLampPostPos(CEntity *Target, CPed *Cop, CVector &TargetCoors, CVector &SourceOut);
bool GetLookOverShoulderPos(CEntity *Target, CPed *Cop, CVector &TargetCoors, CVector &SourceOut);
// custom stuff
void Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrientation, float, float);
void Process_FollowCar_SA(const CVector &CameraTarget, float TargetOrientation, float, float);
2019-05-15 14:52:37 +00:00
};
2020-05-10 13:54:37 +00:00
2020-04-02 10:48:01 +00:00
class CCamPathSplines
2019-05-15 14:52:37 +00:00
{
2020-04-02 10:48:01 +00:00
public:
enum {MAXPATHLENGTH=800};
2020-06-18 22:10:41 +00:00
// float m_arr_PathData[MAXPATHLENGTH];
float *m_arr_PathData;
2020-04-02 10:48:01 +00:00
CCamPathSplines(void);
2019-05-15 14:52:37 +00:00
};
struct CTrainCamNode
{
CVector m_cvecCamPosition;
CVector m_cvecPointToLookAt;
CVector m_cvecMinPointInRange;
CVector m_cvecMaxPointInRange;
float m_fDesiredFOV;
float m_fNearClip;
};
struct CQueuedMode
{
int16 Mode;
float Duration;
int16 MinZoom;
int16 MaxZoom;
};
enum
{
LOOKING_BEHIND,
LOOKING_LEFT,
LOOKING_RIGHT,
LOOKING_FORWARD,
};
2019-05-31 09:44:43 +00:00
enum
{
// TODO: find better names
FADE_0, // faded in
2019-05-31 09:44:43 +00:00
FADE_1, // mid fade
FADE_2, // faded out
2019-05-31 09:44:43 +00:00
// Direction
2019-06-12 23:18:38 +00:00
FADE_OUT = 0,
2019-05-31 09:44:43 +00:00
FADE_IN,
2020-03-26 13:16:06 +00:00
FADE_NONE
2019-05-31 09:44:43 +00:00
};
enum
{
2020-06-27 21:01:51 +00:00
MOTION_BLUR_NONE = 0,
MOTION_BLUR_SNIPER,
MOTION_BLUR_LIGHT_SCENE,
MOTION_BLUR_SECURITY_CAM,
MOTION_BLUR_CUT_SCENE,
MOTION_BLUR_INTRO,
MOTION_BLUR_INTRO2,
MOTION_BLUR_SNIPER_ZOOM,
MOTION_BLUR_INTRO3,
MOTION_BLUR_INTRO4,
2019-05-31 09:44:43 +00:00
};
2020-01-31 10:23:15 +00:00
enum
{
NONE = 0,
INTERPOLATION,
JUMP_CUT
};
enum
{
2020-04-02 10:48:01 +00:00
CAMCONTROL_GAME,
CAMCONTROL_SCRIPT,
CAMCONTROL_OBBE
2020-01-31 10:23:15 +00:00
};
2020-04-02 10:48:01 +00:00
class CCamera : public CPlaceable
2019-05-15 14:52:37 +00:00
{
2020-04-02 10:48:01 +00:00
public:
2019-05-15 14:52:37 +00:00
bool m_bAboveGroundTrainNodesLoaded;
bool m_bBelowGroundTrainNodesLoaded;
bool m_bCamDirectlyBehind;
bool m_bCamDirectlyInFront;
bool m_bCameraJustRestored;
bool m_bcutsceneFinished;
bool m_bCullZoneChecksOn;
bool m_bFirstPersonBeingUsed;
bool m_bJustJumpedOutOf1stPersonBecauseOfTarget;
bool m_bIdleOn;
bool m_bInATunnelAndABigVehicle;
bool m_bInitialNodeFound;
bool m_bInitialNoNodeStaticsSet;
bool m_bIgnoreFadingStuffForMusic;
bool m_bPlayerIsInGarage;
2020-06-09 13:50:00 +00:00
bool m_bPlayerWasOnBike;
2019-05-15 14:52:37 +00:00
bool m_bJustCameOutOfGarage;
bool m_bJustInitalised;
bool m_bJust_Switched;
bool m_bLookingAtPlayer;
bool m_bLookingAtVector;
bool m_bMoveCamToAvoidGeom;
bool m_bObbeCinematicPedCamOn;
bool m_bObbeCinematicCarCamOn;
bool m_bRestoreByJumpCut;
bool m_bUseNearClipScript;
bool m_bStartInterScript;
bool m_bStartingSpline;
bool m_bTargetJustBeenOnTrain;
bool m_bTargetJustCameOffTrain;
bool m_bUseSpecialFovTrain;
bool m_bUseTransitionBeta;
bool m_bUseScriptZoomValuePed;
bool m_bUseScriptZoomValueCar;
bool m_bWaitForInterpolToFinish;
bool m_bItsOkToLookJustAtThePlayer;
bool m_bWantsToSwitchWidescreenOff;
bool m_WideScreenOn;
bool m_1rstPersonRunCloseToAWall;
bool m_bHeadBob;
2020-05-31 15:05:49 +00:00
bool m_bVehicleSuspenHigh;
2020-06-09 13:50:00 +00:00
bool m_bEnable1rstPersonCamCntrlsScript;
bool m_bAllow1rstPersonWeaponsCamera;
2019-05-15 14:52:37 +00:00
bool m_bFailedCullZoneTestPreviously;
2020-04-02 10:48:01 +00:00
bool m_FadeTargetIsSplashScreen;
2019-05-15 14:52:37 +00:00
bool WorldViewerBeingUsed;
uint8 ActiveCam;
uint32 m_uiCamShakeStart;
uint32 m_uiFirstPersonCamLastInputTime;
uint32 m_uiLongestTimeInMill;
uint32 m_uiNumberOfTrainCamNodes;
uint8 m_uiTransitionJUSTStarted;
uint8 m_uiTransitionState; // 0:one mode 1:transition
uint32 m_uiTimeLastChange;
2020-06-09 13:50:00 +00:00
uint32 m_uiTimeWeLeftIdle_StillNoInput;
2019-05-15 14:52:37 +00:00
uint32 m_uiTimeWeEnteredIdle;
uint32 m_uiTimeTransitionStart;
uint32 m_uiTransitionDuration;
2020-06-09 13:50:00 +00:00
uint32 m_uiTransitionDurationTargetCoors;
2019-05-15 14:52:37 +00:00
int m_BlurBlue;
int m_BlurGreen;
int m_BlurRed;
int m_BlurType;
int m_iWorkOutSpeedThisNumFrames;
int m_iNumFramesSoFar;
int m_iCurrentTrainCamNode;
int m_motionBlur;
int m_imotionBlurAddAlpha;
int m_iCheckCullZoneThisNumFrames;
int m_iZoneCullFrameNumWereAt;
int WhoIsInControlOfTheCamera;
float CamFrontXNorm;
float CamFrontYNorm;
#ifdef FIX_BUGS
2020-04-08 06:58:08 +00:00
int32 CarZoomIndicator;
#else
2019-05-15 14:52:37 +00:00
float CarZoomIndicator;
2020-04-08 06:58:08 +00:00
#endif
2019-05-15 14:52:37 +00:00
float CarZoomValue;
float CarZoomValueSmooth;
float DistanceToWater;
float FOVDuringInter;
float LODDistMultiplier;
float GenerationDistMultiplier;
float m_fAlphaSpeedAtStartInter;
float m_fAlphaWhenInterPol;
float m_fAlphaDuringInterPol;
float m_fBetaDuringInterPol;
float m_fBetaSpeedAtStartInter;
float m_fBetaWhenInterPol;
float m_fFOVWhenInterPol;
float m_fFOVSpeedAtStartInter;
float m_fStartingBetaForInterPol;
float m_fStartingAlphaForInterPol;
float m_PedOrientForBehindOrInFront;
float m_CameraAverageSpeed;
float m_CameraSpeedSoFar;
float m_fCamShakeForce;
float m_fCarZoomValueScript;
float m_fFovForTrain;
float m_fFOV_Wide_Screen;
float m_fNearClipScript;
float m_fOldBetaDiff;
float m_fPedZoomValue;
2020-04-02 10:48:01 +00:00
float m_fPedZoomValueScript;
float m_fPedZoomValueSmooth;
float m_fPositionAlongSpline;
float m_ScreenReductionPercentage;
float m_ScreenReductionSpeed;
float m_AlphaForPlayerAnim1rstPerson;
float Orientation;
#ifdef FIX_BUGS
2020-04-08 06:58:08 +00:00
int32 PedZoomIndicator;
#else
2020-04-02 10:48:01 +00:00
float PedZoomIndicator;
2020-04-08 06:58:08 +00:00
#endif
2020-04-02 10:48:01 +00:00
float PlayerExhaustion;
2020-06-09 13:50:00 +00:00
float SoundDistUp;
float SoundDistUpAsRead;
float SoundDistUpAsReadOld;
float m_fAvoidTheGeometryProbsTimer;
int16 m_nAvoidTheGeometryProbsDirn;
2020-04-02 10:48:01 +00:00
float m_fWideScreenReductionAmount;
float m_fStartingFOVForInterPol;
2019-05-15 14:52:37 +00:00
2020-06-09 13:50:00 +00:00
static float m_fMouseAccelHorzntl;// acceleration multiplier for 1st person controls
static float m_fMouseAccelVertical;// acceleration multiplier for 1st person controls
2020-05-17 18:43:11 +00:00
static float m_f3rdPersonCHairMultX;
static float m_f3rdPersonCHairMultY;
2019-05-15 14:52:37 +00:00
CCam Cams[3];
2020-04-02 10:48:01 +00:00
CGarage *pToGarageWeAreIn;
CGarage *pToGarageWeAreInForHackAvoidFirstPerson;
2019-05-15 14:52:37 +00:00
CQueuedMode m_PlayerMode;
CQueuedMode PlayerWeaponMode;
CVector m_PreviousCameraPosition;
CVector m_RealPreviousCameraPosition;
CVector m_cvecAimingTargetCoors;
CVector m_vecFixedModeVector;
CVector m_vecFixedModeSource;
CVector m_vecFixedModeUpOffSet;
CVector m_vecCutSceneOffset;
2019-05-15 14:52:37 +00:00
2020-04-02 10:48:01 +00:00
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;
2020-06-09 13:50:00 +00:00
CVector m_vecClearGeometryVec;
2019-05-15 14:52:37 +00:00
CVector m_vecGameCamPos;
CVector SourceDuringInter;
CVector TargetDuringInter;
CVector UpDuringInter;
RwCamera *m_pRwCamera;
CEntity *pTargetEntity;
2020-04-02 10:48:01 +00:00
CCamPathSplines m_arrPathArray[MAX_NUM_OF_SPLINETYPES];
2020-06-09 13:50:00 +00:00
#ifdef GTA_TRAIN
2020-04-02 10:48:01 +00:00
CTrainCamNode m_arrTrainCamNode[MAX_NUM_OF_NODES];
2020-06-09 13:50:00 +00:00
#endif
2019-05-15 14:52:37 +00:00
CMatrix m_cameraMatrix;
bool m_bGarageFixedCamPositionSet;
bool m_vecDoingSpecialInterPolation;
bool m_bScriptParametersSetForInterPol;
bool m_bFading;
bool m_bMusicFading;
CMatrix m_viewMatrix;
CVector m_vecFrustumNormals[4];
CVector m_vecOldSourceForInter;
CVector m_vecOldFrontForInter;
CVector m_vecOldUpForInter;
float m_vecOldFOVForInter;
float m_fFLOATingFade;
float m_fFLOATingFadeMusic;
float m_fTimeToFadeOut;
float m_fTimeToFadeMusic;
2020-06-09 13:50:00 +00:00
float m_fFractionInterToStopMoving;
float m_fFractionInterToStopCatchUp;
2019-05-15 14:52:37 +00:00
float m_fFractionInterToStopMovingTarget;
float m_fFractionInterToStopCatchUpTarget;
float m_fGaitSwayBuffer;
float m_fScriptPercentageInterToStopMoving;
float m_fScriptPercentageInterToCatchUp;
2020-04-02 10:48:01 +00:00
uint32 m_fScriptTimeForInterPolation;
2019-05-15 14:52:37 +00:00
2020-03-26 13:16:06 +00:00
int16 m_iFadingDirection;
int m_iModeObbeCamIsInForCar;
2019-05-15 14:52:37 +00:00
int16 m_iModeToGoTo;
int16 m_iMusicFadingDirection;
int16 m_iTypeOfSwitch;
uint32 m_uiFadeTimeStarted;
uint32 m_uiFadeTimeStartedMusic;
2020-04-17 05:54:14 +00:00
static bool m_bUseMouse3rdPerson;
2020-04-02 10:48:01 +00:00
#ifdef FREE_CAM
static bool bFreeCam;
#endif
2019-05-15 14:52:37 +00:00
2020-04-02 10:48:01 +00:00
// High level and misc
2020-04-19 14:38:10 +00:00
CCamera(void);
2020-04-02 10:48:01 +00:00
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);
2019-07-08 19:44:32 +00:00
bool Get_Just_Switched_Status() { return m_bJust_Switched; }
2020-06-09 13:50:00 +00:00
void AvoidTheGeometry(const CVector &Source, const CVector &TargetPos, CVector &NewSource, float FOV);
void GetArrPosForVehicleType(int apperance, int &index);
2020-06-18 22:10:41 +00:00
void GetScreenRect(CRect &rect);
2020-04-02 10:48:01 +00:00
// 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);
2019-07-09 16:50:35 +00:00
2020-04-02 10:48:01 +00:00
// Transition
void StartTransition(int16 mode);
void StartTransitionWhenNotFinishedInter(int16 mode);
void StoreValuesDuringInterPol(CVector &source, CVector &target, CVector &up, float &FOV);
2019-05-31 09:44:43 +00:00
2020-04-02 10:48:01 +00:00
// Widescreen borders
void SetWideScreenOn(void);
void SetWideScreenOff(void);
2020-04-02 10:48:01 +00:00
void ProcessWideScreenOn(void);
void DrawBordersForWideScreen(void);
2020-04-02 10:48:01 +00:00
// Obbe's cam
bool IsItTimeForNewcam(int32 obbeMode, int32 time);
bool TryToStartNewCamMode(int32 obbeMode);
void DontProcessObbeCinemaCamera(void);
void ProcessObbeCinemaCameraCar(void);
2020-06-18 22:10:41 +00:00
void ProcessObbeCinemaCameraHeli(void);
2020-04-02 10:48:01 +00:00
void ProcessObbeCinemaCameraPed(void);
2019-08-03 13:01:13 +00:00
2020-04-02 10:48:01 +00:00
// Train
void LoadTrainCamNodes(char const *name);
void Process_Train_Camera_Control(void);
2019-08-15 14:51:39 +00:00
2020-04-02 10:48:01 +00:00
// Script
2019-09-28 14:03:00 +00:00
void LoadPathSplines(int file);
2020-06-18 22:10:41 +00:00
void DeleteCutSceneCamDataMemory(void);
2019-09-28 14:03:00 +00:00
void FinishCutscene(void);
2020-04-02 10:48:01 +00:00
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);
2019-09-28 14:03:00 +00:00
2020-04-02 10:48:01 +00:00
// 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);
2019-10-07 21:29:30 +00:00
void SetCameraDirectlyInFrontForFollowPed_CamOnAString(void);
2020-01-03 16:48:13 +00:00
void SetCameraDirectlyBehindForFollowPed_CamOnAString(void);
2020-04-02 10:48:01 +00:00
void SetNewPlayerWeaponMode(int16 mode, int16 minZoom, int16 maxZoom);
void ClearPlayerWeaponMode(void);
void UpdateAimingCoors(CVector const &coors);
2020-06-18 22:10:41 +00:00
bool Find3rdPersonCamTargetVector(float dist, CVector pos, CVector &source, CVector &target);
2020-04-02 10:48:01 +00:00
float Find3rdPersonQuickAimPitch(void);
2020-05-24 13:14:27 +00:00
bool Using1stPersonWeaponMode(void);
2020-01-28 14:30:13 +00:00
2020-04-02 10:48:01 +00:00
// 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);
2019-05-15 14:52:37 +00:00
};
2020-05-10 13:54:37 +00:00
2020-05-10 16:04:36 +00:00
VALIDATE_SIZE(CCamera, 0xE9D8);
2020-03-26 13:16:06 +00:00
2020-04-17 05:54:14 +00:00
extern CCamera TheCamera;
2020-03-26 13:16:06 +00:00
void CamShakeNoPos(CCamera*, float);
2020-04-02 10:48:01 +00:00
void MakeAngleLessThan180(float &Angle);
void WellBufferMe(float Target, float *CurrentValue, float *CurrentSpeed, float MaxSpeed, float Acceleration, bool IsAngle);