diff options
author | Nikolay Korolev <nickvnuk@gmail.com> | 2019-06-29 13:38:37 +0200 |
---|---|---|
committer | Nikolay Korolev <nickvnuk@gmail.com> | 2019-06-29 13:38:37 +0200 |
commit | 9b5392d3a13e00d880e895522c19ef1e453804b0 (patch) | |
tree | 9c807c08baa487aa9c65d06489ef363ddf8491ff /src/control | |
parent | Changed to actual crimes names (diff) | |
download | re3-9b5392d3a13e00d880e895522c19ef1e453804b0.tar re3-9b5392d3a13e00d880e895522c19ef1e453804b0.tar.gz re3-9b5392d3a13e00d880e895522c19ef1e453804b0.tar.bz2 re3-9b5392d3a13e00d880e895522c19ef1e453804b0.tar.lz re3-9b5392d3a13e00d880e895522c19ef1e453804b0.tar.xz re3-9b5392d3a13e00d880e895522c19ef1e453804b0.tar.zst re3-9b5392d3a13e00d880e895522c19ef1e453804b0.zip |
Diffstat (limited to '')
-rw-r--r-- | src/control/Replay.cpp | 43 | ||||
-rw-r--r-- | src/control/Replay.h | 5 |
2 files changed, 42 insertions, 6 deletions
diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp index 2e0f07ee..a2a47295 100644 --- a/src/control/Replay.cpp +++ b/src/control/Replay.cpp @@ -165,8 +165,6 @@ void CReplay::Init(void) bDoLoadSceneWhenDone = false; } -WRAPPER void CReplay::EmptyReplayBuffer(void) { EAXJMP(0x595BD0); } - void CReplay::DisableReplays(void) { bReplayEnabled = false; @@ -406,7 +404,46 @@ void CReplay::StoreDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState } } #endif +#if 0 WRAPPER void CReplay::ProcessPedUpdate(CPed *ped, float interpolation, CAddressInReplayBuffer *buffer) { EAXJMP(0x594050); } +#else +void CReplay::ProcessPedUpdate(CPed *ped, float interpolation, CAddressInReplayBuffer *buffer) +{ + tPedUpdatePacket *pp = (tPedUpdatePacket*)&buffer->m_pBase[buffer->m_nOffset]; + if (ped){ + ped->m_fRotationCur = pp->heading * M_PI / 128.0f; + ped->m_fRotationDest = pp->heading * M_PI / 128.0f; + CMatrix ped_matrix; + float coeff = 1.0f - interpolation; + pp->matrix.DecompressIntoFullMatrix(ped_matrix); + ped->GetMatrix() = ped->GetMatrix() * CMatrix(coeff); + *ped->GetMatrix().GetPosition() *= coeff; + ped->GetMatrix() += CMatrix(coeff) * ped_matrix; + if (pp->vehicle_index) { + ped->m_pMyVehicle = CPools::GetVehiclePool()->GetSlot(pp->vehicle_index - 1); + ped->bInVehicle = pp->vehicle_index; + } + else { + ped->m_pMyVehicle = nil; + ped->bInVehicle = false; + } + if (pp->assoc_group_id != ped->m_animGroup) { + ped->m_animGroup = (AssocGroupId)pp->assoc_group_id; + if (ped->IsPlayer()) + ((CPlayerPed*)ped)->ReApplyMoveAnims(); + } + RetrievePedAnimation(ped, &pp->anim_state); + ped->RemoveWeaponModel(-1); + if (pp->weapon_model != -1) + ped->AddWeaponModel(pp->weapon_model); + CWorld::Remove(ped); + CWorld::Add(ped); + }else{ + debug("Replay:Ped wasn't there\n"); + } + buffer->m_nOffset += sizeof(tPedUpdatePacket); +} +#endif WRAPPER void CReplay::RetrievePedAnimation(CPed *ped, CStoredAnimationState *state) { EAXJMP(0x5942A0); } WRAPPER void CReplay::RetrieveDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState *state) { EAXJMP(0x5944B0); } WRAPPER void CReplay::PlaybackThisFrame(void) { EAXJMP(0x5946B0); } @@ -453,7 +490,7 @@ void CReplay::StoreCarUpdate(CVehicle *vehicle, int id) WRAPPER void CReplay::ProcessCarUpdate(CVehicle *vehicle, float interpolation, CAddressInReplayBuffer *buffer) { EAXJMP(0x594D10); } WRAPPER bool CReplay::PlayBackThisFrameInterpolation(CAddressInReplayBuffer *buffer, float interpolation, uint32 *pTimer) { EAXJMP(0x595240); } WRAPPER void CReplay::FinishPlayback(void) { EAXJMP(0x595B20); } -WRAPPER void CReplay::Shutdown(void) { EAXJMP(0x595BD0); } +WRAPPER void CReplay::EmptyReplayBuffer(void) { EAXJMP(0x595BD0); } WRAPPER void CReplay::ProcessReplayCamera(void) { EAXJMP(0x595C40); } #if 0 diff --git a/src/control/Replay.h b/src/control/Replay.h index c4f3b1a2..0a65c638 100644 --- a/src/control/Replay.h +++ b/src/control/Replay.h @@ -155,7 +155,7 @@ class CReplay int8 vehicle_index; CStoredAnimationState anim_state; CCompressedMatrixNotAligned matrix; - uint8 assoc_group_id; + int8 assoc_group_id; uint8 weapon_model; }; static_assert(sizeof(tPedUpdatePacket) == 40, "tPedUpdatePacket: error"); @@ -244,12 +244,11 @@ private: public: static void Init(void); - static void EmptyReplayBuffer(void); static void DisableReplays(void); static void EnableReplays(void); static void Update(void); static void FinishPlayback(void); - static void Shutdown(void); + static void EmptyReplayBuffer(void); static void Display(void); static void TriggerPlayback(uint8 cam_mode, float cam_x, float cam_y, float cam_z, bool load_scene); static void StreamAllNecessaryCarsAndPeds(void); |