summaryrefslogtreecommitdiffstats
path: root/src/DamageManager.h
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 /src/DamageManager.h
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
Diffstat (limited to 'src/DamageManager.h')
-rw-r--r--src/DamageManager.h137
1 files changed, 92 insertions, 45 deletions
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);