diff options
author | aap <aap@papnet.eu> | 2020-01-31 12:57:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-31 12:57:43 +0100 |
commit | 5794732ad4582dfb583f9554c66201ab982ba22b (patch) | |
tree | ffea6b8d1383a57081898cc369d24bfae591d9dc /src/core | |
parent | Merge pull request #298 from Sergeanur/save (diff) | |
parent | suggested fixes (diff) | |
download | re3-5794732ad4582dfb583f9554c66201ab982ba22b.tar re3-5794732ad4582dfb583f9554c66201ab982ba22b.tar.gz re3-5794732ad4582dfb583f9554c66201ab982ba22b.tar.bz2 re3-5794732ad4582dfb583f9554c66201ab982ba22b.tar.lz re3-5794732ad4582dfb583f9554c66201ab982ba22b.tar.xz re3-5794732ad4582dfb583f9554c66201ab982ba22b.tar.zst re3-5794732ad4582dfb583f9554c66201ab982ba22b.zip |
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/Camera.cpp | 77 | ||||
-rw-r--r-- | src/core/Camera.h | 2 | ||||
-rw-r--r-- | src/core/FileLoader.cpp | 2 |
3 files changed, 74 insertions, 7 deletions
diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp index a8295763..64a52bdc 100644 --- a/src/core/Camera.cpp +++ b/src/core/Camera.cpp @@ -25,16 +25,11 @@ WRAPPER void CCamera::Restore(void) { EAXJMP(0x46F990); } WRAPPER void CamShakeNoPos(CCamera*, float) { EAXJMP(0x46B100); } WRAPPER void CCamera::TakeControl(CEntity*, int16, int16, int32) { EAXJMP(0x471500); } WRAPPER void CCamera::TakeControlNoEntity(const CVector&, int16, int32) { EAXJMP(0x4715B0); } -WRAPPER void CCamera::SetCamPositionForFixedMode(const CVector&, const CVector&) { EAXJMP(0x46FCC0); } WRAPPER void CCamera::Init(void) { EAXJMP(0x46BAD0); } -WRAPPER void CCamera::SetRwCamera(RwCamera*) { EAXJMP(0x46FEC0); } WRAPPER void CCamera::Process(void) { EAXJMP(0x46D3F0); } WRAPPER void CCamera::LoadPathSplines(int file) { EAXJMP(0x46D1D0); } -WRAPPER uint32 CCamera::GetCutSceneFinishTime(void) { EAXJMP(0x46B920); } -WRAPPER void CCamera::FinishCutscene(void) { EAXJMP(0x46B560); } WRAPPER void CCamera::RestoreWithJumpCut(void) { EAXJMP(0x46FAE0); }; -WRAPPER void CCamera::SetZoomValueFollowPedScript(int16) { EAXJMP(0x46FF30); } -WRAPPER void CCamera::SetZoomValueCamStringScript(int16) { EAXJMP(0x46FF90); } +WRAPPER void CCamera::SetPercentAlongCutScene(float) { EAXJMP(0x46FE20); }; bool CCamera::GetFading() @@ -1394,6 +1389,68 @@ CCamera::UpdateAimingCoors(CVector const &coors) m_cvecAimingTargetCoors = coors;
} +void +CCamera::SetCamPositionForFixedMode(const CVector &Source, const CVector &UpOffSet) +{ + m_vecFixedModeSource = Source;
+ m_vecFixedModeUpOffSet = UpOffSet; +} + +void +CCamera::SetRwCamera(RwCamera *cam) +{ + m_pRwCamera = cam;
+ m_viewMatrix.Attach(&m_pRwCamera->viewMatrix, false);
+ CMBlur::MotionBlurOpen(m_pRwCamera); +} + +uint32 +CCamera::GetCutSceneFinishTime(void) +{ + int cam = ActiveCam;
+ if (Cams[cam].Mode == CCam::MODE_FLYBY)
+ return Cams[cam].m_uiFinishTime;
+ cam = (cam + 1) % 2;
+ if (Cams[cam].Mode == CCam::MODE_FLYBY)
+ return Cams[cam].m_uiFinishTime;
+
+ return 0; +} + +void +CCamera::FinishCutscene(void) +{ + SetPercentAlongCutScene(100.0f);
+ m_fPositionAlongSpline = 1.0f;
+ m_bcutsceneFinished = true; +} + +void +CCamera::SetZoomValueFollowPedScript(int16 mode) +{
+ switch (mode) {
+ case 0: m_fPedZoomValueScript = 0.25f; break;
+ case 1: m_fPedZoomValueScript = 1.5f; break;
+ case 2: m_fPedZoomValueScript = 2.9f; break;
+ default: m_fPedZoomValueScript = m_fPedZoomValueScript; break;
+ }
+
+ m_bUseScriptZoomValuePed = true; +} + +void +CCamera::SetZoomValueCamStringScript(int16 mode) +{
+ switch (mode) {
+ case 0: m_fCarZoomValueScript = 0.05f; break;
+ case 1: m_fCarZoomValueScript = 1.9f; break;
+ case 2: m_fCarZoomValueScript = 3.9f; break;
+ default: m_fCarZoomValueScript = m_fCarZoomValueScript; break;
+ }
+
+ m_bUseScriptZoomValueCar = true; +} + STARTPATCHES InjectHook(0x42C760, (bool (CCamera::*)(const CVector ¢er, float radius, const CMatrix *mat))&CCamera::IsSphereVisible, PATCH_JUMP); InjectHook(0x46FD00, &CCamera::SetFadeColour, PATCH_JUMP); @@ -1407,6 +1464,14 @@ STARTPATCHES InjectHook(0x46FF00, &CCamera::SetWideScreenOn, PATCH_JUMP); InjectHook(0x46FF10, &CCamera::SetWideScreenOff, PATCH_JUMP); + InjectHook(0x46FCC0, &CCamera::SetCamPositionForFixedMode, PATCH_JUMP); + InjectHook(0x46FEC0, &CCamera::SetRwCamera, PATCH_JUMP); + InjectHook(0x46B920, &CCamera::GetCutSceneFinishTime, PATCH_JUMP); + InjectHook(0x46B560, &CCamera::FinishCutscene, PATCH_JUMP); + InjectHook(0x46FF30, &CCamera::SetZoomValueFollowPedScript, PATCH_JUMP); + InjectHook(0x46FF90, &CCamera::SetZoomValueCamStringScript, PATCH_JUMP); + + InjectHook(0x456F40, WellBufferMe, PATCH_JUMP); InjectHook(0x4582F0, &CCam::GetVectorsReadyForRW, PATCH_JUMP); InjectHook(0x457710, &CCam::DoAverageOnVector, PATCH_JUMP); diff --git a/src/core/Camera.h b/src/core/Camera.h index 99028de6..3e67903f 100644 --- a/src/core/Camera.h +++ b/src/core/Camera.h @@ -511,6 +511,8 @@ int m_iModeObbeCamIsInForCar; void SetNewPlayerWeaponMode(int16, int16, int16); void UpdateAimingCoors(CVector const &); + void SetPercentAlongCutScene(float); + void dtor(void) { this->CCamera::~CCamera(); } }; static_assert(offsetof(CCamera, m_WideScreenOn) == 0x70, "CCamera: error"); diff --git a/src/core/FileLoader.cpp b/src/core/FileLoader.cpp index 8fb4b4d9..b49fccbb 100644 --- a/src/core/FileLoader.cpp +++ b/src/core/FileLoader.cpp @@ -679,7 +679,7 @@ CFileLoader::LoadMLOInstance(int id, const char *line) &scale.x, &scale.y, &scale.z, &rot.x, &rot.y, &rot.z, &angle); - float rad = 2.0f * (PI / 2.0f - Atan2(angle, Sqrt(1.0f - SQR(angle)))); + float rad = Acos(angle) * 2.0f; CInstance *inst = CModelInfo::GetMloInstanceStore().alloc(); minfo->lastInstance++; |