CCamera done

This commit is contained in:
aap 2020-06-19 00:10:41 +02:00
parent e9e533b0cb
commit c5205a89ee
9 changed files with 988 additions and 419 deletions

View File

@ -3513,6 +3513,11 @@ CCam::Process_FlyBy(const CVector&, float, float, float)
if(TheCamera.m_bcutsceneFinished) if(TheCamera.m_bcutsceneFinished)
return; return;
#ifdef FIX_BUGS
// this would crash, not nice when cycling debug mode
if(TheCamera.m_arrPathArray[0].m_arr_PathData == nil)
return;
#endif
Up = CVector(0.0f, 0.0f, 1.0f); Up = CVector(0.0f, 0.0f, 1.0f);
if(TheCamera.m_bStartingSpline) if(TheCamera.m_bStartingSpline)

File diff suppressed because it is too large Load Diff

View File

@ -249,7 +249,8 @@ class CCamPathSplines
{ {
public: public:
enum {MAXPATHLENGTH=800}; enum {MAXPATHLENGTH=800};
float m_arr_PathData[MAXPATHLENGTH]; // float m_arr_PathData[MAXPATHLENGTH];
float *m_arr_PathData;
CCamPathSplines(void); CCamPathSplines(void);
}; };
@ -551,6 +552,7 @@ public:
bool Get_Just_Switched_Status() { return m_bJust_Switched; } bool Get_Just_Switched_Status() { return m_bJust_Switched; }
void AvoidTheGeometry(const CVector &Source, const CVector &TargetPos, CVector &NewSource, float FOV); void AvoidTheGeometry(const CVector &Source, const CVector &TargetPos, CVector &NewSource, float FOV);
void GetArrPosForVehicleType(int apperance, int &index); void GetArrPosForVehicleType(int apperance, int &index);
void GetScreenRect(CRect &rect);
// Who's in control // Who's in control
void TakeControl(CEntity *target, int16 mode, int16 typeOfSwitch, int32 controller); void TakeControl(CEntity *target, int16 mode, int16 typeOfSwitch, int32 controller);
@ -576,6 +578,7 @@ public:
bool TryToStartNewCamMode(int32 obbeMode); bool TryToStartNewCamMode(int32 obbeMode);
void DontProcessObbeCinemaCamera(void); void DontProcessObbeCinemaCamera(void);
void ProcessObbeCinemaCameraCar(void); void ProcessObbeCinemaCameraCar(void);
void ProcessObbeCinemaCameraHeli(void);
void ProcessObbeCinemaCameraPed(void); void ProcessObbeCinemaCameraPed(void);
// Train // Train
@ -584,6 +587,7 @@ public:
// Script // Script
void LoadPathSplines(int file); void LoadPathSplines(int file);
void DeleteCutSceneCamDataMemory(void);
void FinishCutscene(void); void FinishCutscene(void);
float GetPositionAlongSpline(void) { return m_fPositionAlongSpline; } float GetPositionAlongSpline(void) { return m_fPositionAlongSpline; }
uint32 GetCutSceneFinishTime(void); uint32 GetCutSceneFinishTime(void);
@ -617,7 +621,7 @@ public:
void SetNewPlayerWeaponMode(int16 mode, int16 minZoom, int16 maxZoom); void SetNewPlayerWeaponMode(int16 mode, int16 minZoom, int16 maxZoom);
void ClearPlayerWeaponMode(void); void ClearPlayerWeaponMode(void);
void UpdateAimingCoors(CVector const &coors); void UpdateAimingCoors(CVector const &coors);
void Find3rdPersonCamTargetVector(float dist, CVector pos, CVector &source, CVector &target); bool Find3rdPersonCamTargetVector(float dist, CVector pos, CVector &source, CVector &target);
float Find3rdPersonQuickAimPitch(void); float Find3rdPersonQuickAimPitch(void);
bool Using1stPersonWeaponMode(void); bool Using1stPersonWeaponMode(void);

View File

@ -535,9 +535,6 @@ DebugMenuPopulate(void)
DebugMenuAddVarBool8("Cam", "Print Debug Code", &PrintDebugCode, nil); DebugMenuAddVarBool8("Cam", "Print Debug Code", &PrintDebugCode, nil);
DebugMenuAddVar("Cam", "Cam Mode", &DebugCamMode, nil, 1, 0, CCam::MODE_EDITOR, nil); DebugMenuAddVar("Cam", "Cam Mode", &DebugCamMode, nil, 1, 0, CCam::MODE_EDITOR, nil);
DebugMenuAddCmd("Cam", "Normal", []() { DebugCamMode = 0; }); DebugMenuAddCmd("Cam", "Normal", []() { DebugCamMode = 0; });
DebugMenuAddCmd("Cam", "Follow Ped With Bind", []() { DebugCamMode = CCam::MODE_FOLLOW_PED_WITH_BIND; });
DebugMenuAddCmd("Cam", "Reaction", []() { DebugCamMode = CCam::MODE_REACTION; });
DebugMenuAddCmd("Cam", "Chris", []() { DebugCamMode = CCam::MODE_CHRIS; });
DebugMenuAddCmd("Cam", "Reset Statics", ResetCamStatics); DebugMenuAddCmd("Cam", "Reset Statics", ResetCamStatics);
CTweakVars::AddDBG("Debug"); CTweakVars::AddDBG("Debug");

View File

@ -83,7 +83,8 @@ RwFrame *RwFrameTranslate(RwFrame * frame, const RwV3d * v, RwOpCombineType comb
RwFrame *RwFrameRotate(RwFrame * frame, const RwV3d * axis, RwReal angle, RwOpCombineType combine) { frame->rotate(axis, angle, (CombineOp)combine); return frame; } RwFrame *RwFrameRotate(RwFrame * frame, const RwV3d * axis, RwReal angle, RwOpCombineType combine) { frame->rotate(axis, angle, (CombineOp)combine); return frame; }
RwFrame *RwFrameScale(RwFrame * frame, const RwV3d * v, RwOpCombineType combine) { frame->scale(v, (CombineOp)combine); return frame; } RwFrame *RwFrameScale(RwFrame * frame, const RwV3d * v, RwOpCombineType combine) { frame->scale(v, (CombineOp)combine); return frame; }
RwFrame *RwFrameTransform(RwFrame * frame, const RwMatrix * m, RwOpCombineType combine) { frame->transform(m, (CombineOp)combine); return frame; } RwFrame *RwFrameTransform(RwFrame * frame, const RwMatrix * m, RwOpCombineType combine) { frame->transform(m, (CombineOp)combine); return frame; }
//RwFrame *RwFrameOrthoNormalize(RwFrame * frame); //TODO: actually implement this!
RwFrame *RwFrameOrthoNormalize(RwFrame * frame) { return frame; }
RwFrame *RwFrameSetIdentity(RwFrame * frame) { frame->matrix.setIdentity(); frame->updateObjects(); return frame; } RwFrame *RwFrameSetIdentity(RwFrame * frame) { frame->matrix.setIdentity(); frame->updateObjects(); return frame; }
//RwFrame *RwFrameCloneHierarchy(RwFrame * root); //RwFrame *RwFrameCloneHierarchy(RwFrame * root);
//RwBool RwFrameDestroyHierarchy(RwFrame * frame); //RwBool RwFrameDestroyHierarchy(RwFrame * frame);

View File

@ -8988,6 +8988,13 @@ CPed::GetWeaponSlot(eWeaponType weaponType)
return CWeaponInfo::GetWeaponInfo(weaponType)->m_nWeaponSlot; return CWeaponInfo::GetWeaponInfo(weaponType)->m_nWeaponSlot;
} }
// --MIAMI: Done
bool
CPed::CanWeRunAndFireWithWeapon(void)
{
return CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->m_bCanAimWithArm;
}
void void
CPed::GoToNearestDoor(CVehicle *veh) CPed::GoToNearestDoor(CVehicle *veh)
{ {

View File

@ -798,6 +798,7 @@ public:
int GetNextPointOnRoute(void); int GetNextPointOnRoute(void);
uint8 GetPedRadioCategory(uint32); uint8 GetPedRadioCategory(uint32);
int GetWeaponSlot(eWeaponType); int GetWeaponSlot(eWeaponType);
bool CanWeRunAndFireWithWeapon(void);
void GoToNearestDoor(CVehicle*); void GoToNearestDoor(CVehicle*);
bool HaveReachedNextPointOnRoute(float); bool HaveReachedNextPointOnRoute(float);
void Idle(void); void Idle(void);

View File

@ -146,13 +146,13 @@ CMBlur::CreateImmediateModeData(RwCamera *cam, RwRect *rect)
} }
void void
CMBlur::MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 blur, int32 type) CMBlur::MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 blur, int32 type, uint32 alpha)
{ {
RwRGBA color = { (RwUInt8)red, (RwUInt8)green, (RwUInt8)blue, (RwUInt8)blur }; RwRGBA color = { (RwUInt8)red, (RwUInt8)green, (RwUInt8)blue, (RwUInt8)blur };
if(ms_bJustInitialised) if(ms_bJustInitialised)
ms_bJustInitialised = false; ms_bJustInitialised = false;
else else
OverlayRender(cam, pFrontBuffer, color, type); OverlayRender(cam, pFrontBuffer, color, type, alpha);
if(BlurOn){ if(BlurOn){
RwRasterPushContext(pFrontBuffer); RwRasterPushContext(pFrontBuffer);
RwRasterRenderFast(RwCameraGetRaster(cam), 0, 0); RwRasterRenderFast(RwCameraGetRaster(cam), 0, 0);
@ -161,7 +161,7 @@ CMBlur::MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, u
} }
void void
CMBlur::OverlayRender(RwCamera *cam, RwRaster *raster, RwRGBA color, int32 type) CMBlur::OverlayRender(RwCamera *cam, RwRaster *raster, RwRGBA color, int32 type, int32 alpha)
{ {
int r, g, b, a; int r, g, b, a;
@ -284,6 +284,12 @@ CMBlur::OverlayRender(RwCamera *cam, RwRaster *raster, RwRGBA color, int32 type)
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA); RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
} }
void
CMBlur::SetDrunkBlur(float drunkness)
{
Drunkness = clamp(drunkness, 0.0f, 1.0f);
}
void void
CMBlur::ClearDrunkBlur() CMBlur::ClearDrunkBlur()
{ {

View File

@ -22,8 +22,9 @@ public:
static void MotionBlurOpen(RwCamera *cam); static void MotionBlurOpen(RwCamera *cam);
static void MotionBlurClose(void); static void MotionBlurClose(void);
static void CreateImmediateModeData(RwCamera *cam, RwRect *rect); static void CreateImmediateModeData(RwCamera *cam, RwRect *rect);
static void MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 blur, int32 type); static void MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 blur, int32 type, uint32 alpha);
static void OverlayRender(RwCamera *cam, RwRaster *raster, RwRGBA color, int32 type); static void OverlayRender(RwCamera *cam, RwRaster *raster, RwRGBA color, int32 type, int32 alpha);
static void SetDrunkBlur(float drunkness);
static void ClearDrunkBlur(); static void ClearDrunkBlur();
//TODO //TODO