summaryrefslogtreecommitdiffstats
path: root/src/control
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2019-06-23 00:34:11 +0200
committerNikolay Korolev <nickvnuk@gmail.com>2019-06-23 00:34:11 +0200
commit98cc8a434c0a484d2d56e1cb34dc88d7d98a0853 (patch)
treef8ac26e96ee38e77d12ea86006150c909da88926 /src/control
parentFixed little bug in Radar.cpp. (diff)
downloadre3-98cc8a434c0a484d2d56e1cb34dc88d7d98a0853.tar
re3-98cc8a434c0a484d2d56e1cb34dc88d7d98a0853.tar.gz
re3-98cc8a434c0a484d2d56e1cb34dc88d7d98a0853.tar.bz2
re3-98cc8a434c0a484d2d56e1cb34dc88d7d98a0853.tar.lz
re3-98cc8a434c0a484d2d56e1cb34dc88d7d98a0853.tar.xz
re3-98cc8a434c0a484d2d56e1cb34dc88d7d98a0853.tar.zst
re3-98cc8a434c0a484d2d56e1cb34dc88d7d98a0853.zip
Diffstat (limited to 'src/control')
-rw-r--r--src/control/Replay.cpp24
-rw-r--r--src/control/Replay.h17
2 files changed, 37 insertions, 4 deletions
diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp
index a8d87302..d9cd2a80 100644
--- a/src/control/Replay.cpp
+++ b/src/control/Replay.cpp
@@ -132,7 +132,6 @@ void CReplay::Update(void)
#if 0
WRAPPER void CReplay::RecordThisFrame(void) { EAXJMP(0x5932B0); }
#else
-
void CReplay::RecordThisFrame(void)
{
tGeneralPacket* general = (tGeneralPacket*)&Record.m_pBase[Record.m_nOffset];
@@ -182,7 +181,7 @@ void CReplay::RecordThisFrame(void)
if (!CBulletTraces::aTraces[i].m_bInUse)
continue;
tBulletTracePacket* bt = (tBulletTracePacket*)&Record.m_pBase[Record.m_nOffset];
- bt->type = REPLAYPACKET_BULLETTRACES;
+ bt->type = REPLAYPACKET_BULLET_TRACES;
bt->index = i;
bt->frames = CBulletTraces::aTraces[i].m_bFramesInUse;
bt->lifetime = CBulletTraces::aTraces[i].m_bLifeTime;
@@ -210,7 +209,28 @@ void CReplay::RecordThisFrame(void)
MarkEverythingAsNew();
}
#endif
+
+#if 0
WRAPPER void CReplay::StorePedUpdate(CPed *ped, int id) { EAXJMP(0x5935B0); }
+#else
+void CReplay::StorePedUpdate(CPed *ped, int id)
+{
+ tPedUpdatePacket* pp = (tPedUpdatePacket*)&Record.m_pBase[Record.m_nOffset];
+ pp->type = REPLAYPACKET_PED_UPDATE;
+ pp->index = id;
+ pp->heading = 128.0f / M_PI * ped->m_fRotationCur;
+ pp->matrix.CompressFromFullMatrix(ped->GetMatrix());
+ pp->assoc_group_id = ped->m_animGroup;
+ /* Would be more sane to use GetJustIndex(ped->m_pMyVehicle) in following assignment */
+ if (ped->bInVehicle && ped->m_pMyVehicle)
+ pp->vehicle_index = (CPools::GetVehiclePool()->GetIndex(ped->m_pMyVehicle) >> 8) + 1;
+ else
+ pp->vehicle_index = 0;
+ pp->weapon_model = ped->m_wepModelID;
+ StorePedAnimation(ped, &pp->anim_state);
+ Record.m_nOffset += sizeof(tPedUpdatePacket);
+}
+#endif
WRAPPER void CReplay::StorePedAnimation(CPed *ped, CStoredAnimationState *state) { EAXJMP(0x593670); }
WRAPPER void CReplay::StoreDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState *state) { EAXJMP(0x593BB0); }
WRAPPER void CReplay::ProcessPedUpdate(CPed *ped, float interpolation, CAddressInReplayBuffer *buffer) { EAXJMP(0x594050); }
diff --git a/src/control/Replay.h b/src/control/Replay.h
index b37bd29f..b73b249c 100644
--- a/src/control/Replay.h
+++ b/src/control/Replay.h
@@ -65,13 +65,13 @@ class CReplay
REPLAYPACKET_END = 0,
REPLAYPACKET_VEHICLE = 1,
REPLAYPACKET_PED_HEADER = 2,
- REPLAYPACKET_PED = 3,
+ REPLAYPACKET_PED_UPDATE = 3,
REPLAYPACKET_GENERAL = 4,
REPLAYPACKET_CLOCK = 5,
REPLAYPACKET_WEATHER = 6,
REPLAYPACKET_ENDOFFRAME = 7,
REPLAYPACKET_TIMER = 8,
- REPLAYPACKET_BULLETTRACES = 9
+ REPLAYPACKET_BULLET_TRACES = 9
};
enum {
@@ -146,6 +146,19 @@ class CReplay
};
static_assert(sizeof(tEndOfFramePacket) == 4, "tEndOfFramePacket: error");
+ struct tPedUpdatePacket
+ {
+ uint8 type;
+ uint8 index;
+ int8 heading;
+ int8 vehicle_index;
+ CStoredAnimationState anim_state;
+ CCompressedMatrixNotAligned matrix;
+ uint8 assoc_group_id;
+ uint8 weapon_model;
+ };
+ static_assert(sizeof(tPedUpdatePacket) == 40, "tPedUpdatePacket: error");
+
private:
static uint8 &Mode;
static CAddressInReplayBuffer &Record;