summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2019-07-05 22:19:52 +0200
committeraap <aap@papnet.eu>2019-07-05 22:20:28 +0200
commit49d97f0033c4406a359cba88e988c7311241a76a (patch)
tree912011b0a39707e90c0f1cbdf8a165939bbed2fd
parentMerge pull request #108 from ShFil119/audio3 (diff)
downloadre3-49d97f0033c4406a359cba88e988c7311241a76a.tar
re3-49d97f0033c4406a359cba88e988c7311241a76a.tar.gz
re3-49d97f0033c4406a359cba88e988c7311241a76a.tar.bz2
re3-49d97f0033c4406a359cba88e988c7311241a76a.tar.lz
re3-49d97f0033c4406a359cba88e988c7311241a76a.tar.xz
re3-49d97f0033c4406a359cba88e988c7311241a76a.tar.zst
re3-49d97f0033c4406a359cba88e988c7311241a76a.zip
-rw-r--r--src/DamageManager.cpp244
-rw-r--r--src/DamageManager.h137
-rw-r--r--src/common.h13
-rw-r--r--src/control/Replay.cpp91
4 files changed, 383 insertions, 102 deletions
diff --git a/src/DamageManager.cpp b/src/DamageManager.cpp
index a065e187..1a7f25ed 100644
--- a/src/DamageManager.cpp
+++ b/src/DamageManager.cpp
@@ -1,21 +1,243 @@
#include "common.h"
#include "patcher.h"
+#include "General.h"
#include "DamageManager.h"
-#if 0
-WRAPPER void CDamageManager::SetDoorStatus(int door, unsigned int status) { EAXJMP(0x545920); }
-#else
-void CDamageManager::SetDoorStatus(int door, unsigned int status)
+
+float G_aComponentDamage[] = { 2.5f, 1.25f, 3.2f, 1.4f, 2.5f, 2.8f, 0.5f };
+
+void
+CDamageManager::ResetDamageStatus(void)
{
- m_bDoorStatus[door] = status;
+ memset(this, 0, sizeof(*this));
}
-#endif
-#if 0
-WRAPPER unsigned int CDamageManager::GetDoorStatus(int door) { EAXJMP(0x545930); }
+void
+CDamageManager::FuckCarCompletely(void)
+{
+ int i;
+
+ m_wheelStatus[0] = 2;
+ // wheels 1-3 not reset?
+
+ m_doorStatus[0] = 3;
+ m_doorStatus[1] = 3;
+ m_doorStatus[2] = 3;
+ m_doorStatus[3] = 3;
+ m_doorStatus[4] = 3;
+ m_doorStatus[5] = 3;
+
+ for(i = 0; i < 3; i++){
+#ifdef FIX_BUGS
+ ProgressPanelDamage(VEHBUMPER_FRONT);
+ ProgressPanelDamage(VEHBUMPER_REAR);
#else
-unsigned int CDamageManager::GetDoorStatus(int door)
+ // this can't be right
+ ProgressPanelDamage(COMPONENT_BUMPER_FRONT);
+ ProgressPanelDamage(COMPONENT_BUMPER_REAR);
+#endif
+ }
+ // Why set to no damage?
+ m_lightStatus = 0;
+ m_panelStatus = 0;
+ SetEngineStatus(250);
+}
+
+bool
+CDamageManager::ApplyDamage(tComponent component, float damage, float unused)
+{
+ tComponentGroup group;
+ uint8 subComp;
+
+ GetComponentGroup(component, &group, &subComp);
+ damage *= G_aComponentDamage[group];
+ if(damage > 150.0f){
+ switch(group){
+ case COMPGROUP_WHEEL:
+ ProgressWheelDamage(subComp);
+ break;
+ case COMPGROUP_DOOR:
+ case COMPGROUP_BOOT:
+ ProgressDoorDamage(subComp);
+ break;
+ case COMPGROUP_BONNET:
+ if(damage > 220.0f)
+ ProgressEngineDamage();
+ ProgressDoorDamage(subComp);
+ break;
+ case COMPGROUP_PANEL:
+ // so windscreen is a light?
+ SetLightStatus((eLights)subComp, 1);
+ // fall through
+ case COMPGROUP_BUMPER:
+ if(damage > 220.0f &&
+ (component == COMPONENT_PANEL_FRONT_LEFT ||
+ component == COMPONENT_PANEL_FRONT_RIGHT ||
+ component == COMPONENT_PANEL_WINDSCREEN))
+ ProgressEngineDamage();
+ ProgressPanelDamage(subComp);
+ break;
+ }
+ return true;
+ }
+ return false;
+}
+
+bool
+CDamageManager::GetComponentGroup(tComponent component, tComponentGroup *componentGroup, uint8 *subComp)
{
- return m_bDoorStatus[door];
+ *subComp = -2; // ??
+
+ // This is done very strangely in the game, maybe an optimized switch?
+ if(component >= COMPONENT_PANEL_FRONT_LEFT){
+ if(component >= COMPONENT_BUMPER_FRONT)
+ *componentGroup = COMPGROUP_BUMPER;
+ else
+ *componentGroup = COMPGROUP_PANEL;
+ *subComp = component - COMPONENT_PANEL_FRONT_LEFT;
+ return true;
+ }else if(component >= COMPONENT_DOOR_BONNET){
+ if(component == COMPONENT_DOOR_BONNET)
+ *componentGroup = COMPGROUP_BONNET;
+ else if(component == COMPONENT_DOOR_BOOT)
+ *componentGroup = COMPGROUP_BOOT;
+ else
+ *componentGroup = COMPGROUP_DOOR;
+ *subComp = component - COMPONENT_DOOR_BONNET;
+ return true;
+ }else if(component >= COMPONENT_WHEEL_FRONT_LEFT){
+ *componentGroup = COMPGROUP_WHEEL;
+ *subComp = component - COMPONENT_WHEEL_FRONT_LEFT;
+ return true;
+ }else if(component >= COMPONENT_DEFAULT){
+ *componentGroup = COMPGROUP_DEFAULT;
+ *subComp = component - COMPONENT_DEFAULT;
+ return true;
+ }else
+ return false;
+}
+
+void
+CDamageManager::SetDoorStatus(int32 door, uint32 status)
+{
+ m_doorStatus[door] = status;
}
-#endif \ No newline at end of file
+
+int32
+CDamageManager::GetDoorStatus(int32 door)
+{
+ return m_doorStatus[door];
+}
+
+bool
+CDamageManager::ProgressDoorDamage(uint8 door)
+{
+ int status = GetDoorStatus(door);
+ if(status == 3)
+ return false;
+ SetDoorStatus(door, status+1);
+ return true;
+}
+
+void
+CDamageManager::SetPanelStatus(int32 panel, uint32 status)
+{
+ m_panelStatus = dpb(status, panel*4, 4, m_panelStatus);
+}
+
+int32
+CDamageManager::GetPanelStatus(int32 panel)
+{
+ return ldb(panel*4, 4, m_panelStatus);
+}
+
+bool
+CDamageManager::ProgressPanelDamage(uint8 panel)
+{
+ int status = GetPanelStatus(panel);
+ if(status == 3)
+ return false;
+ SetPanelStatus(panel, status+1);
+ return true;
+}
+
+void
+CDamageManager::SetLightStatus(eLights light, uint32 status)
+{
+ m_lightStatus = dpb(status, light*2, 2, m_lightStatus);
+}
+
+int32
+CDamageManager::GetLightStatus(eLights light)
+{
+ return ldb(light*2, 2, m_lightStatus);
+}
+
+void
+CDamageManager::SetWheelStatus(int32 wheel, uint32 status)
+{
+ m_wheelStatus[wheel] = status;
+}
+
+int32
+CDamageManager::GetWheelStatus(int32 wheel)
+{
+ return m_wheelStatus[wheel];
+}
+
+bool
+CDamageManager::ProgressWheelDamage(uint8 wheel)
+{
+ int status = GetWheelStatus(wheel);
+ if(status == 3)
+ return false;
+ SetWheelStatus(wheel, status+1);
+ return true;
+}
+
+void
+CDamageManager::SetEngineStatus(uint32 status)
+{
+ if(status > 250)
+ m_engineStatus = 250;
+ else
+ m_engineStatus = status;
+}
+
+int32
+CDamageManager::GetEngineStatus(void)
+{
+ return m_engineStatus;
+}
+
+bool
+CDamageManager::ProgressEngineDamage(void)
+{
+ int status = GetEngineStatus();
+ int newstatus = status + 32 + (CGeneral::GetRandomNumber() & 0x1F);
+ if(status < 225 && newstatus > 224)
+ newstatus = 224;
+ SetEngineStatus(newstatus);
+ return true;
+}
+
+STARTPATCHES
+ InjectHook(0x545850, &CDamageManager::ResetDamageStatus, PATCH_JUMP);
+ InjectHook(0x545B70, &CDamageManager::FuckCarCompletely, PATCH_JUMP);
+ InjectHook(0x545790, &CDamageManager::GetComponentGroup, PATCH_JUMP);
+ InjectHook(0x545A80, &CDamageManager::ApplyDamage, PATCH_JUMP);
+ InjectHook(0x545920, &CDamageManager::SetDoorStatus, PATCH_JUMP);
+ InjectHook(0x545930, &CDamageManager::GetDoorStatus, PATCH_JUMP);
+ InjectHook(0x545970, &CDamageManager::ProgressDoorDamage, PATCH_JUMP);
+ InjectHook(0x5458B0, &CDamageManager::SetPanelStatus, PATCH_JUMP);
+ InjectHook(0x5458E0, (int32 (CDamageManager::*)(int32))&CDamageManager::GetPanelStatus, PATCH_JUMP);
+ InjectHook(0x545A00, &CDamageManager::ProgressPanelDamage, PATCH_JUMP);
+ InjectHook(0x545860, &CDamageManager::SetLightStatus, PATCH_JUMP);
+ InjectHook(0x545890, &CDamageManager::GetLightStatus, PATCH_JUMP);
+ InjectHook(0x545900, &CDamageManager::SetWheelStatus, PATCH_JUMP);
+ InjectHook(0x545910, &CDamageManager::GetWheelStatus, PATCH_JUMP);
+ InjectHook(0x545A40, &CDamageManager::ProgressWheelDamage, PATCH_JUMP);
+ InjectHook(0x545940, &CDamageManager::SetEngineStatus, PATCH_JUMP);
+ InjectHook(0x545960, &CDamageManager::GetEngineStatus, PATCH_JUMP);
+ InjectHook(0x5459B0, &CDamageManager::ProgressEngineDamage, PATCH_JUMP);
+ENDPATCHES
diff --git a/src/DamageManager.h b/src/DamageManager.h
index 4c1e3925..974c54ee 100644
--- a/src/DamageManager.h
+++ b/src/DamageManager.h
@@ -2,53 +2,100 @@
#include "common.h"
+// TODO: move some of this into Vehicle.h
+
+enum tComponent
+{
+ COMPONENT_DEFAULT,
+ COMPONENT_WHEEL_FRONT_LEFT,
+ COMPONENT_WHEEL_FRONT_RIGHT,
+ COMPONENT_WHEEL_REAR_LEFT,
+ COMPONENT_WHEEL_REAR_RIGHT,
+ COMPONENT_DOOR_BONNET,
+ COMPONENT_DOOR_BOOT,
+ COMPONENT_DOOR_FRONT_LEFT,
+ COMPONENT_DOOR_FRONT_RIGHT,
+ COMPONENT_DOOR_REAR_LEFT,
+ COMPONENT_DOOR_REAR_RIGHT,
+ COMPONENT_PANEL_FRONT_LEFT,
+ COMPONENT_PANEL_FRONT_RIGHT,
+ COMPONENT_PANEL_REAR_LEFT,
+ COMPONENT_PANEL_REAR_RIGHT,
+ COMPONENT_PANEL_WINDSCREEN,
+ COMPONENT_BUMPER_FRONT,
+ COMPONENT_BUMPER_REAR,
+};
+
+enum tComponentGroup
+{
+ COMPGROUP_BUMPER,
+ COMPGROUP_WHEEL,
+ COMPGROUP_DOOR,
+ COMPGROUP_BONNET,
+ COMPGROUP_BOOT,
+ COMPGROUP_PANEL,
+ COMPGROUP_DEFAULT,
+};
+
+enum eLights
+{
+ VEHLIGHT_FRONT_LEFT,
+ VEHLIGHT_FRONT_RIGHT,
+ VEHLIGHT_REAR_LEFT,
+ VEHLIGHT_REAR_RIGHT,
+};
+
+enum {
+ VEHDOOR_BONNET = 0,
+ VEHDOOR_BOOT,
+ VEHDOOR_FRONT_LEFT,
+ VEHDOOR_FRONT_RIGHT,
+ VEHDOOR_REAR_LEFT,
+ VEHDOOR_REAR_RIGHT
+};
+
+enum {
+ VEHPANEL_FRONT_LEFT,
+ VEHPANEL_FRONT_RIGHT,
+ VEHPANEL_REAR_LEFT,
+ VEHPANEL_REAR_RIGHT,
+ VEHPANEL_WINDSCREEN,
+ VEHBUMPER_FRONT,
+ VEHBUMPER_REAR,
+};
+
class CDamageManager
{
public:
- enum {
- CAR_DOOR_BONNET = 0,
- CAR_DOOR_BUMPER,
- CAR_DOOR_LF,
- CAR_DOOR_RF,
- CAR_DOOR_LR,
- 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;
- char field_27;
-
- void SetDoorStatus(int, unsigned int);
- unsigned int GetDoorStatus(int);
-}; \ No newline at end of file
+ uint8 m_engineStatus;
+ uint8 m_wheelStatus[4];
+ uint8 m_doorStatus[6];
+ uint32 m_lightStatus;
+ uint32 m_panelStatus;
+ uint32 field_24;
+
+ void ResetDamageStatus(void);
+ void FuckCarCompletely(void);
+ bool ApplyDamage(tComponent component, float damage, float unused);
+ bool GetComponentGroup(tComponent component, tComponentGroup *componentGroup, uint8 *foo);
+
+ void SetDoorStatus(int32 door, uint32 status);
+ int32 GetDoorStatus(int32 door);
+ bool ProgressDoorDamage(uint8 door);
+ void SetPanelStatus(int32 panel, uint32 status);
+ int32 GetPanelStatus(int32 panel);
+ bool ProgressPanelDamage(uint8 panel);
+ // needed for CReplay
+ static int32 GetPanelStatus(uint32 panelstatus, int32 panel) { return ldb(panel*4, 4, panelstatus); }
+ void SetLightStatus(eLights light, uint32 status);
+ int32 GetLightStatus(eLights light);
+ void SetWheelStatus(int32 wheel, uint32 status);
+ int32 GetWheelStatus(int32 wheel);
+ bool ProgressWheelDamage(uint8 wheel);
+ void SetEngineStatus(uint32 status);
+ int32 GetEngineStatus(void);
+ bool ProgressEngineDamage(void);
+};
+VALIDATE_SIZE(CDamageManager, 0x1C);
diff --git a/src/common.h b/src/common.h
index 3d260f6e..79626acb 100644
--- a/src/common.h
+++ b/src/common.h
@@ -49,6 +49,19 @@ typedef uint16_t wchar;
#define ALIGNPTR(p) (void*)((((uintptr)(void*)p) + sizeof(void*)-1) & ~(sizeof(void*)-1))
+// PDP-10 like byte functions
+#define MASK(p, s) (((1<<(s))-1) << (p))
+inline uint32 dpb(uint32 b, uint32 p, uint32 s, uint32 w)
+{
+ uint32 m = MASK(p,s);
+ return w & ~m | b<<p & m;
+}
+inline uint32 ldb(uint32 p, uint32 s, uint32 w)
+{
+ return w>>p & (1<<s)-1;
+}
+
+
// little hack
extern void **rwengine;
#define RwEngineInstance (*rwengine)
diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp
index 12fce4ef..cb3b27d0 100644
--- a/src/control/Replay.cpp
+++ b/src/control/Replay.cpp
@@ -135,34 +135,33 @@ WRAPPER static void ApplyPanelDamageToCar(uint32, CAutomobile*, bool) { EAXJMP(0
#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.GetPanelStatus(VEHPANEL_FRONT_LEFT) != CDamageManager::GetPanelStatus(panels, VEHPANEL_FRONT_LEFT)){
+ vehicle->m_DamageManager.SetPanelStatus(VEHPANEL_FRONT_LEFT, CDamageManager::GetPanelStatus(panels, VEHPANEL_FRONT_LEFT));
+ vehicle->SetPanelDamage(13, VEHPANEL_FRONT_LEFT, 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.GetPanelStatus(VEHPANEL_FRONT_RIGHT) != CDamageManager::GetPanelStatus(panels, VEHPANEL_FRONT_RIGHT)){
+ vehicle->m_DamageManager.SetPanelStatus(VEHPANEL_FRONT_RIGHT, CDamageManager::GetPanelStatus(panels, VEHPANEL_FRONT_RIGHT));
+ vehicle->SetPanelDamage(9, VEHPANEL_FRONT_RIGHT, 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.GetPanelStatus(VEHPANEL_REAR_LEFT) != CDamageManager::GetPanelStatus(panels, VEHPANEL_REAR_LEFT)){
+ vehicle->m_DamageManager.SetPanelStatus(VEHPANEL_REAR_LEFT, CDamageManager::GetPanelStatus(panels, VEHPANEL_REAR_LEFT));
+ vehicle->SetPanelDamage(14, VEHPANEL_REAR_LEFT, 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.GetPanelStatus(VEHPANEL_REAR_RIGHT) != CDamageManager::GetPanelStatus(panels, VEHPANEL_REAR_RIGHT)){
+ vehicle->m_DamageManager.SetPanelStatus(VEHPANEL_REAR_RIGHT, CDamageManager::GetPanelStatus(panels, VEHPANEL_REAR_RIGHT));
+ vehicle->SetPanelDamage(10, VEHPANEL_REAR_RIGHT, 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.GetPanelStatus(VEHPANEL_WINDSCREEN) != CDamageManager::GetPanelStatus(panels, VEHPANEL_WINDSCREEN)){
+ vehicle->m_DamageManager.SetPanelStatus(VEHPANEL_WINDSCREEN, CDamageManager::GetPanelStatus(panels, VEHPANEL_WINDSCREEN));
+ vehicle->SetPanelDamage(19, VEHPANEL_WINDSCREEN, 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.GetPanelStatus(VEHBUMPER_FRONT) != CDamageManager::GetPanelStatus(panels, VEHBUMPER_FRONT)){
+ vehicle->m_DamageManager.SetPanelStatus(VEHBUMPER_FRONT, CDamageManager::GetPanelStatus(panels, VEHBUMPER_FRONT));
+ vehicle->SetPanelDamage(7, VEHBUMPER_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);
+ if(vehicle->m_DamageManager.GetPanelStatus(VEHBUMPER_REAR) != CDamageManager::GetPanelStatus(panels, VEHBUMPER_REAR)){
+ vehicle->m_DamageManager.SetPanelStatus(VEHBUMPER_REAR, CDamageManager::GetPanelStatus(panels, VEHBUMPER_REAR));
+ vehicle->SetPanelDamage(8, VEHBUMPER_REAR, flying);
}
}
#endif
@@ -625,7 +624,7 @@ void CReplay::StoreCarUpdate(CVehicle *vehicle, int id)
vp->matrix.CompressFromFullMatrix(vehicle->GetMatrix());
vp->health = vehicle->m_fHealth / 4.0f; /* Not anticipated that health can be > 1000. */
vp->acceleration = vehicle->m_fGasPedal * 100.0f;
- vp->panels = vehicle->IsCar() ? ((CAutomobile*)vehicle)->m_DamageManager.m_abPanelsStatus : 0;
+ vp->panels = vehicle->IsCar() ? ((CAutomobile*)vehicle)->m_DamageManager.m_panelStatus : 0;
vp->velocityX = 8000.0f * max(-4.0f, min(4.0f, vehicle->GetSpeed().x)); /* 8000!? */
vp->velocityY = 8000.0f * max(-4.0f, min(4.0f, vehicle->GetSpeed().y));
vp->velocityZ = 8000.0f * max(-4.0f, min(4.0f, vehicle->GetSpeed().z));
@@ -646,7 +645,7 @@ void CReplay::StoreCarUpdate(CVehicle *vehicle, int id)
vp->door_angles[1] = 127.0f / M_PI * car->m_aDoors[3].m_fAngle;
vp->door_status = 0;
for (int i = 0; i < 6; i++){
- if (car->m_DamageManager.m_bDoorStatus[i] == 3)
+ if (car->m_DamageManager.GetDoorStatus(i) == 3)
vp->door_status |= BIT(i);
}
}
@@ -690,32 +689,32 @@ void CReplay::ProcessCarUpdate(CVehicle *vehicle, float interpolation, CAddressI
car->m_aDoors[2].m_fAngle = car->m_aDoors[2].m_fPreviousAngle = vp->door_angles[0] * M_PI / 127.0f;
car->m_aDoors[3].m_fAngle = car->m_aDoors[3].m_fPreviousAngle = vp->door_angles[1] * M_PI / 127.0f;
if (vp->door_angles[0])
- car->m_DamageManager.m_bDoorStatus[2] = 2;
+ car->m_DamageManager.SetDoorStatus(2, 2);
if (vp->door_angles[1])
- car->m_DamageManager.m_bDoorStatus[3] = 2;
- if (vp->door_status & 1 && car->m_DamageManager.GetDoorStatus(CDamageManager::CAR_DOOR_BONNET) != 3){
- car->m_DamageManager.SetDoorStatus(CDamageManager::CAR_DOOR_BONNET, 3);
- car->SetDoorDamage(17, CDamageManager::CAR_DOOR_BONNET, true);
+ car->m_DamageManager.SetDoorStatus(3, 2);
+ if (vp->door_status & 1 && car->m_DamageManager.GetDoorStatus(VEHDOOR_BONNET) != 3){
+ car->m_DamageManager.SetDoorStatus(VEHDOOR_BONNET, 3);
+ car->SetDoorDamage(17, VEHDOOR_BONNET, true);
}
- if (vp->door_status & 2 && car->m_DamageManager.GetDoorStatus(CDamageManager::CAR_DOOR_BUMPER) != 3) {
- car->m_DamageManager.SetDoorStatus(CDamageManager::CAR_DOOR_BUMPER, 3);
- car->SetDoorDamage(18, CDamageManager::CAR_DOOR_BUMPER, true);
+ if (vp->door_status & 2 && car->m_DamageManager.GetDoorStatus(VEHDOOR_BOOT) != 3) {
+ car->m_DamageManager.SetDoorStatus(VEHDOOR_BOOT, 3);
+ car->SetDoorDamage(18, VEHDOOR_BOOT, true);
}
- if (vp->door_status & 4 && car->m_DamageManager.GetDoorStatus(CDamageManager::CAR_DOOR_LF) != 3) {
- car->m_DamageManager.SetDoorStatus(CDamageManager::CAR_DOOR_LF, 3);
- car->SetDoorDamage(15, CDamageManager::CAR_DOOR_LF, true);
+ if (vp->door_status & 4 && car->m_DamageManager.GetDoorStatus(VEHDOOR_FRONT_LEFT) != 3) {
+ car->m_DamageManager.SetDoorStatus(VEHDOOR_FRONT_LEFT, 3);
+ car->SetDoorDamage(15, VEHDOOR_FRONT_LEFT, true);
}
- if (vp->door_status & 8 && car->m_DamageManager.GetDoorStatus(CDamageManager::CAR_DOOR_RF) != 3) {
- car->m_DamageManager.SetDoorStatus(CDamageManager::CAR_DOOR_RF, 3);
- car->SetDoorDamage(11, CDamageManager::CAR_DOOR_RF, true);
+ if (vp->door_status & 8 && car->m_DamageManager.GetDoorStatus(VEHDOOR_FRONT_RIGHT) != 3) {
+ car->m_DamageManager.SetDoorStatus(VEHDOOR_FRONT_RIGHT, 3);
+ car->SetDoorDamage(11, VEHDOOR_FRONT_RIGHT, true);
}
- if (vp->door_status & 0x10 && car->m_DamageManager.GetDoorStatus(CDamageManager::CAR_DOOR_LR) != 3) {
- car->m_DamageManager.SetDoorStatus(CDamageManager::CAR_DOOR_LR, 3);
- car->SetDoorDamage(16, CDamageManager::CAR_DOOR_LR, true);
+ if (vp->door_status & 0x10 && car->m_DamageManager.GetDoorStatus(VEHDOOR_REAR_LEFT) != 3) {
+ car->m_DamageManager.SetDoorStatus(VEHDOOR_REAR_LEFT, 3);
+ car->SetDoorDamage(16, VEHDOOR_REAR_LEFT, true);
}
- if (vp->door_status & 0x20 && car->m_DamageManager.GetDoorStatus(CDamageManager::CAR_DOOR_RR) != 3) {
- car->m_DamageManager.SetDoorStatus(CDamageManager::CAR_DOOR_RR, 3);
- car->SetDoorDamage(12, CDamageManager::CAR_DOOR_RR, true);
+ if (vp->door_status & 0x20 && car->m_DamageManager.GetDoorStatus(VEHDOOR_REAR_RIGHT) != 3) {
+ car->m_DamageManager.SetDoorStatus(VEHDOOR_REAR_RIGHT, 3);
+ car->SetDoorDamage(12, VEHDOOR_REAR_RIGHT, true);
}
vehicle->bEngineOn = true;
if (vehicle->IsCar())
@@ -1195,8 +1194,8 @@ void CReplay::RestoreStuffFromMem(void)
}
if (vehicle->IsCar()){
CAutomobile* car = (CAutomobile*)vehicle;
- int32 panels = car->m_DamageManager.m_abPanelsStatus;
- car->m_DamageManager.m_abPanelsStatus = 0;
+ int32 panels = car->m_DamageManager.m_panelStatus;
+ car->m_DamageManager.m_panelStatus = 0;
ApplyPanelDamageToCar(panels, car, true);
car->SetDoorDamage(17, 0, true); /* BONNET */
car->SetDoorDamage(18, 1, true); /* BUMPER */