mirror of
https://git.rip/DMCA_FUCKER/re3.git
synced 2024-12-23 05:30:00 +00:00
StorePedUpdate
This commit is contained in:
parent
0126bef9a1
commit
98cc8a434c
|
@ -132,7 +132,6 @@ void CReplay::Update(void)
|
||||||
#if 0
|
#if 0
|
||||||
WRAPPER void CReplay::RecordThisFrame(void) { EAXJMP(0x5932B0); }
|
WRAPPER void CReplay::RecordThisFrame(void) { EAXJMP(0x5932B0); }
|
||||||
#else
|
#else
|
||||||
|
|
||||||
void CReplay::RecordThisFrame(void)
|
void CReplay::RecordThisFrame(void)
|
||||||
{
|
{
|
||||||
tGeneralPacket* general = (tGeneralPacket*)&Record.m_pBase[Record.m_nOffset];
|
tGeneralPacket* general = (tGeneralPacket*)&Record.m_pBase[Record.m_nOffset];
|
||||||
|
@ -182,7 +181,7 @@ void CReplay::RecordThisFrame(void)
|
||||||
if (!CBulletTraces::aTraces[i].m_bInUse)
|
if (!CBulletTraces::aTraces[i].m_bInUse)
|
||||||
continue;
|
continue;
|
||||||
tBulletTracePacket* bt = (tBulletTracePacket*)&Record.m_pBase[Record.m_nOffset];
|
tBulletTracePacket* bt = (tBulletTracePacket*)&Record.m_pBase[Record.m_nOffset];
|
||||||
bt->type = REPLAYPACKET_BULLETTRACES;
|
bt->type = REPLAYPACKET_BULLET_TRACES;
|
||||||
bt->index = i;
|
bt->index = i;
|
||||||
bt->frames = CBulletTraces::aTraces[i].m_bFramesInUse;
|
bt->frames = CBulletTraces::aTraces[i].m_bFramesInUse;
|
||||||
bt->lifetime = CBulletTraces::aTraces[i].m_bLifeTime;
|
bt->lifetime = CBulletTraces::aTraces[i].m_bLifeTime;
|
||||||
|
@ -210,7 +209,28 @@ void CReplay::RecordThisFrame(void)
|
||||||
MarkEverythingAsNew();
|
MarkEverythingAsNew();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if 0
|
||||||
WRAPPER void CReplay::StorePedUpdate(CPed *ped, int id) { EAXJMP(0x5935B0); }
|
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::StorePedAnimation(CPed *ped, CStoredAnimationState *state) { EAXJMP(0x593670); }
|
||||||
WRAPPER void CReplay::StoreDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState *state) { EAXJMP(0x593BB0); }
|
WRAPPER void CReplay::StoreDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState *state) { EAXJMP(0x593BB0); }
|
||||||
WRAPPER void CReplay::ProcessPedUpdate(CPed *ped, float interpolation, CAddressInReplayBuffer *buffer) { EAXJMP(0x594050); }
|
WRAPPER void CReplay::ProcessPedUpdate(CPed *ped, float interpolation, CAddressInReplayBuffer *buffer) { EAXJMP(0x594050); }
|
||||||
|
|
|
@ -65,13 +65,13 @@ class CReplay
|
||||||
REPLAYPACKET_END = 0,
|
REPLAYPACKET_END = 0,
|
||||||
REPLAYPACKET_VEHICLE = 1,
|
REPLAYPACKET_VEHICLE = 1,
|
||||||
REPLAYPACKET_PED_HEADER = 2,
|
REPLAYPACKET_PED_HEADER = 2,
|
||||||
REPLAYPACKET_PED = 3,
|
REPLAYPACKET_PED_UPDATE = 3,
|
||||||
REPLAYPACKET_GENERAL = 4,
|
REPLAYPACKET_GENERAL = 4,
|
||||||
REPLAYPACKET_CLOCK = 5,
|
REPLAYPACKET_CLOCK = 5,
|
||||||
REPLAYPACKET_WEATHER = 6,
|
REPLAYPACKET_WEATHER = 6,
|
||||||
REPLAYPACKET_ENDOFFRAME = 7,
|
REPLAYPACKET_ENDOFFRAME = 7,
|
||||||
REPLAYPACKET_TIMER = 8,
|
REPLAYPACKET_TIMER = 8,
|
||||||
REPLAYPACKET_BULLETTRACES = 9
|
REPLAYPACKET_BULLET_TRACES = 9
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
@ -146,6 +146,19 @@ class CReplay
|
||||||
};
|
};
|
||||||
static_assert(sizeof(tEndOfFramePacket) == 4, "tEndOfFramePacket: error");
|
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:
|
private:
|
||||||
static uint8 &Mode;
|
static uint8 &Mode;
|
||||||
static CAddressInReplayBuffer &Record;
|
static CAddressInReplayBuffer &Record;
|
||||||
|
|
|
@ -246,3 +246,37 @@ Multiply3x3(const CMatrix &mat, const CVector &vec)
|
||||||
mat.m_matrix.right.y * vec.x + mat.m_matrix.up.y * vec.y + mat.m_matrix.at.y * vec.z,
|
mat.m_matrix.right.y * vec.x + mat.m_matrix.up.y * vec.y + mat.m_matrix.at.y * vec.z,
|
||||||
mat.m_matrix.right.z * vec.x + mat.m_matrix.up.z * vec.y + mat.m_matrix.at.z * vec.z);
|
mat.m_matrix.right.z * vec.x + mat.m_matrix.up.z * vec.y + mat.m_matrix.at.z * vec.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class CCompressedMatrixNotAligned
|
||||||
|
{
|
||||||
|
CVector m_vecPos;
|
||||||
|
int8 m_rightX;
|
||||||
|
int8 m_rightY;
|
||||||
|
int8 m_rightZ;
|
||||||
|
int8 m_upX;
|
||||||
|
int8 m_upY;
|
||||||
|
int8 m_upZ;
|
||||||
|
public:
|
||||||
|
void CompressFromFullMatrix(CMatrix &other)
|
||||||
|
{
|
||||||
|
m_rightX = 127.0f * other.GetRight()->x;
|
||||||
|
m_rightY = 127.0f * other.GetRight()->y;
|
||||||
|
m_rightZ = 127.0f * other.GetRight()->z;
|
||||||
|
m_upX = 127.0f * other.GetForward()->x;
|
||||||
|
m_upY = 127.0f * other.GetForward()->y;
|
||||||
|
m_upZ = 127.0f * other.GetForward()->z;
|
||||||
|
m_vecPos = *other.GetPosition();
|
||||||
|
}
|
||||||
|
void DecompressIntoFullMatrix(CMatrix &other)
|
||||||
|
{
|
||||||
|
other.GetRight()->x = m_rightX / 127.0f;
|
||||||
|
other.GetRight()->y = m_rightY / 127.0f;
|
||||||
|
other.GetRight()->z = m_rightZ / 127.0f;
|
||||||
|
other.GetForward()->x = m_upX / 127.0f;
|
||||||
|
other.GetForward()->y = m_upY / 127.0f;
|
||||||
|
other.GetForward()->z = m_upZ / 127.0f;
|
||||||
|
*other.GetUp() = CrossProduct(*other.GetRight(), *other.GetForward());
|
||||||
|
*other.GetPosition() = m_vecPos;
|
||||||
|
other.Reorthogonalise();
|
||||||
|
}
|
||||||
|
};
|
Loading…
Reference in a new issue