Completed CReplay

This commit is contained in:
Nikolay Korolev 2019-07-01 00:15:34 +03:00
parent 3a763cc6e7
commit 02c7cbc75f
4 changed files with 63 additions and 1 deletions

View file

@ -15,12 +15,35 @@ public:
CAR_DOOR_RR
};
enum {
PANEL_FL = 0,
PANEL_FR,
PANEL_RL,
PANEL_RR,
PANEL_WINDSHIELD,
PANEL_FRONT,
PANEL_BACK
};
struct PanelStatus {
uint32 m_nPanelFrontLeftStatus : 4;
uint32 m_nPanelFrontRightStatus : 4;
uint32 m_nPanelBackLeftStatus : 4;
uint32 m_nPanelBackRightStatus : 4;
uint32 m_nWindshieldStatus : 4;
uint32 m_nPanelFrontStatus : 4;
uint32 m_nPanelBackStatus : 4;
};
float field_0;
char m_bEngineStatus;
char m_bWheelStatus[4];
char m_bDoorStatus[7];
uint32 m_abLightStatus;
union{
PanelStatus m_sPanelsStatus;
uint32 m_abPanelsStatus;
};
char field_24;
char field_25;
char field_26;

View file

@ -130,7 +130,42 @@ static void(*FindCBFunction(uint8 id))(CAnimBlendAssociation*, void*)
return CBArray_RE3[id];
}
#if 0
WRAPPER static void ApplyPanelDamageToCar(uint32, CAutomobile*, bool) { EAXJMP(0x584EA0); }
#else
static void ApplyPanelDamageToCar(uint32 panels, CAutomobile* vehicle, bool flying)
{
CDamageManager::PanelStatus rp = *(CDamageManager::PanelStatus*)&panels;
if (vehicle->m_DamageManager.m_sPanelsStatus.m_nPanelFrontLeftStatus != rp.m_nPanelFrontLeftStatus){
vehicle->m_DamageManager.m_sPanelsStatus.m_nPanelFrontLeftStatus = rp.m_nPanelFrontLeftStatus;
vehicle->SetPanelDamage(13, CDamageManager::PANEL_FL, flying);
}
if (vehicle->m_DamageManager.m_sPanelsStatus.m_nPanelFrontRightStatus != rp.m_nPanelFrontRightStatus) {
vehicle->m_DamageManager.m_sPanelsStatus.m_nPanelFrontRightStatus = rp.m_nPanelFrontRightStatus;
vehicle->SetPanelDamage(9, CDamageManager::PANEL_FR, flying);
}
if (vehicle->m_DamageManager.m_sPanelsStatus.m_nPanelBackLeftStatus != rp.m_nPanelBackLeftStatus) {
vehicle->m_DamageManager.m_sPanelsStatus.m_nPanelBackLeftStatus = rp.m_nPanelBackLeftStatus;
vehicle->SetPanelDamage(14, CDamageManager::PANEL_RL, flying);
}
if (vehicle->m_DamageManager.m_sPanelsStatus.m_nPanelBackRightStatus != rp.m_nPanelBackRightStatus) {
vehicle->m_DamageManager.m_sPanelsStatus.m_nPanelBackRightStatus = rp.m_nPanelBackRightStatus;
vehicle->SetPanelDamage(10, CDamageManager::PANEL_RR, flying);
}
if (vehicle->m_DamageManager.m_sPanelsStatus.m_nWindshieldStatus != rp.m_nWindshieldStatus) {
vehicle->m_DamageManager.m_sPanelsStatus.m_nWindshieldStatus = rp.m_nWindshieldStatus;
vehicle->SetPanelDamage(19, CDamageManager::PANEL_WINDSHIELD, flying);
}
if (vehicle->m_DamageManager.m_sPanelsStatus.m_nPanelFrontStatus != rp.m_nPanelFrontStatus) {
vehicle->m_DamageManager.m_sPanelsStatus.m_nPanelFrontStatus = rp.m_nPanelFrontStatus;
vehicle->SetPanelDamage(7, CDamageManager::PANEL_FRONT, flying);
}
if (vehicle->m_DamageManager.m_sPanelsStatus.m_nPanelBackStatus != rp.m_nPanelBackStatus) {
vehicle->m_DamageManager.m_sPanelsStatus.m_nPanelBackStatus = rp.m_nPanelBackStatus;
vehicle->SetPanelDamage(8, CDamageManager::PANEL_BACK, flying);
}
}
#endif
void PrintElementsInPtrList(void)
{

View file

@ -10,6 +10,8 @@ CAutomobile::CAutomobile(int mi, uint8 owner)
WRAPPER CAutomobile* CAutomobile::ctor(int, uint8) { EAXJMP(0x52C6B0); }
WRAPPER void CAutomobile::SetDoorDamage(int32, uint32, bool) { EAXJMP(0x530200); }
WRAPPER void CAutomobile::SetPanelDamage(int32, uint32, bool) { EAXJMP(0x5301A0); }
WRAPPER void CAutomobile::SetBumperDamage(int32, uint32, bool) { EAXJMP(0x530120); }
STARTPATCHES
InjectHook(0x52D170, &CAutomobile::dtor, PATCH_JUMP);

View file

@ -25,6 +25,8 @@ public:
CAutomobile(int, uint8);
CAutomobile* ctor(int, uint8);
void SetDoorDamage(int32, uint32, bool); /* TODO: eDoors */
void SetPanelDamage(int32, uint32, bool); /* TODO: ePanels */
void SetBumperDamage(int32, uint32, bool); /* TODO: ePanels */
void dtor() { this->CAutomobile::~CAutomobile(); }
};
static_assert(sizeof(CAutomobile) == 0x5A8, "CAutomobile: error");