Phasor  01.00.10.059
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Damage.h
Go to the documentation of this file.
1 #include "../Halo.h"
2 #include "../../../Common/Streams.h"
3 
4 namespace halo {
5 
6  struct s_object_info;
7  struct s_tag_entry;
8 
9  #pragma pack(push, 1)
10 
11  struct s_damage_info {
13  unsigned long flags;
15  ident causer; // obj of causer
16  UNKNOWN(0x30);
17  float modifier; // 1.0 = max dmg, < 0 decreases dmg.
18  float modifier1; // 1.0 default > 1.0 increases dmg.
19  UNKNOWN(8);
20  };
21  static_assert(sizeof(s_damage_info) == 0x50, "bad");
22 
23  struct s_hit_info {
24  char desc[0x20];
25  UNKNOWN(0x28); // doesn't seem to be that useful, mostly 0s with a few 1.0 floats.
26  };
27  static_assert(sizeof(s_hit_info) == 0x48, "bad");
28 
30  {
31  float min_damage;
34 
37  {
38  }
39 
41  : min_damage(min_damage), max_damage_min(max_damage_min),
42  max_damage_max(max_damage_max)
43  {
44  }
45  };
46  static_assert(sizeof(s_damage_amount) == 0x0c, "bad");
47 
48  struct s_damage_tag
49  {
50  float min_range;
51  float max_range;
52  UNKNOWN(0x1BE);
53  short damage_id;
54  UNKNOWN(0x08);
56  UNKNOWN(0xC4);
57  };
58  static_assert(sizeof(s_damage_tag) == 0x2A0, "bad");
59 
60  #pragma pack(pop)
61  namespace damage_flags {
62  static const int kNone = 0x00;
63  static const int kRespawn = 0x02;
64  static const int kInstantKill = 0x04;
65  }
66 
68  {
70  halo::ident causer; // obj id
71  halo::ident causer_player; // player id
73  int flags;
74  float modifier;
75  };
76 
77  // Called when an object's damage is being looked up
78  bool __stdcall OnDamageLookup(s_damage_info* dmg, ident* receiver);
79 
80  // Called when damage is being applied to an object
81  bool __stdcall OnDamageApplication(const s_damage_info* dmg, ident receiver,
82  s_hit_info* hit, bool backtap);
83 
84  // Temporarily modifies globals\vehicle_hit_environment and uses it to apply damage.
85  bool ApplyDamage(halo::ident receiver, halo::ident causer,
86  float dmg, int flags);
87 
88  // Apply the specified damage tag to the receiver
89  void ApplyDamage(halo::ident receiver, halo::ident causer,
90  const halo::s_tag_entry& dmg_tag, float multiplier, int flags);
91 }