forked from Phobos-developers/YRpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BulletClass.h
155 lines (125 loc) · 3.55 KB
/
BulletClass.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
/*
Projectiles
*/
#pragma once
#include <ObjectClass.h>
#include <BulletTypeClass.h>
class TechnoClass;
class ObjectClass;
class WarheadTypeClass;
struct BulletData
{
CDTimerClass UnknownTimer;
CDTimerClass ArmTimer;
CoordStruct Location;
int Distance;
};
// the velocities along the axes, or something like that
using BulletVelocity = Vector3D<double>; // :3 -pd
class NOVTABLE BulletClass : public ObjectClass
{
public:
static const AbstractType AbsID = AbstractType::Bullet;
//Array
static constexpr constant_ptr<DynamicVectorClass<BulletClass*>, 0xA8ED40u> const Array{};
static constexpr reference<DynamicVectorClass<BulletClass*>, 0x89DE18u> const ScalableBullets{};
//IPersist
virtual HRESULT __stdcall GetClassID(CLSID* pClassID) R0;
//IPersistStream
virtual HRESULT __stdcall Save(IStream* pStm, BOOL fClearDirty) R0;
//Destructor
virtual ~BulletClass() RX;
//AbstractClass
virtual AbstractType WhatAmI() const RT(AbstractType);
virtual int Size() const R0;
//BulletClass
virtual BYTE GetAnimFrame() const R0;
virtual void SetTarget(AbstractClass* pTarget) RX;
virtual bool MoveTo(const CoordStruct& where, const BulletVelocity& velocity) R0;
// non-virtual
// after CoCreateInstance creates a bullet, this configures it
void Construct(
BulletTypeClass* pType,
AbstractClass* pTarget,
TechnoClass* pOwner,
int damage,
WarheadTypeClass* pWarhead,
int speed,
bool bright)
{ JMP_THIS(0x4664C0); }
// calls Detonate with the appropriate coords
void Explode(bool destroy = false)
{ JMP_THIS(0x468D80); }
// detonate the bullet at specific coords
void Detonate(const CoordStruct& coords)
{ JMP_THIS(0x4690B0); }
// spawns off the proper amount of shrapnel projectiles
void Shrapnel()
{ JMP_THIS(0x46A310); }
static void ApplyRadiationToCell(CellStruct cell, int radius, int amount)
{ JMP_STD(0x46ADE0); }
// this bullet will miss and hit the ground instead.
// if the original target is in air, it will disappear.
void LoseTarget()
{ JMP_THIS(0x468430); }
bool IsHoming() const
{ return this->Type->ROT > 0; }
void SetWeaponType(WeaponTypeClass *weapon)
{ this->WeaponType = weapon; }
WeaponTypeClass * GetWeaponType() const
{ return this->WeaponType; }
// only called in UnitClass::Fire if Type->Scalable
void InitScalable()
{ JMP_THIS(0x46B280); }
// call only after the target, args, etc., have been set
void NukeMaker()
{ JMP_THIS(0x46B310); }
// helpers
CoordStruct GetTargetCoords() const {
if(this->Target) {
return this->Target->GetCoords();
} else {
return this->GetCoords();
}
}
//Constructor
protected:
BulletClass() noexcept
: BulletClass(noinit_t())
{ JMP_THIS(0x466380); }
protected:
explicit __forceinline BulletClass(noinit_t) noexcept
: ObjectClass(noinit_t())
{ }
//===========================================================================
//===== Properties ==========================================================
//===========================================================================
public:
BulletTypeClass* Type;
TechnoClass* Owner;
bool unknown_B4;
BulletData Data;
bool Bright;
DWORD unknown_E4;
BulletVelocity Velocity;
DWORD unknown_100;
bool unknown_104;
DWORD unknown_108;
AbstractClass* Target;
int Speed;
int InheritedColor;
DWORD unknown_118;
DWORD unknown_11C;
double unknown_120;
WarheadTypeClass* WH;
byte AnimFrame;
byte AnimRateCounter;
WeaponTypeClass* WeaponType;
CoordStruct SourceCoords;
CoordStruct TargetCoords;
CellStruct LastMapCoords;
int DamageMultiplier;
AnimClass* NextAnim;
bool SpawnNextAnim;
int Range;
};