-
Notifications
You must be signed in to change notification settings - Fork 124
Expand file tree
/
Copy pathExplosive.h
More file actions
208 lines (170 loc) · 6.59 KB
/
Explosive.h
File metadata and controls
208 lines (170 loc) · 6.59 KB
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
// Explosive.h: ��������� ��� ������������� ��������
//
//////////////////////////////////////////////////////////////////////
#pragma once
#include "../xrEngine/Render.h"
#include "../xrEngine/feel_touch.h"
#include "inventory_item.h"
#include "ai_sounds.h"
#include "script_export_space.h"
#include "../xrphysics/DamageSource.h"
#include "wallmark_manager.h"
#include "ParticlesObject.h"
#include "hudsound.h"
// GhenTuong: on_explode callback
#ifndef CEXPLOSIVE_CHANGE
#define CEXPLOSIVE_CHANGE
#endif
class IRender_Light;
DEFINE_VECTOR(CPhysicsShellHolder*, BLASTED_OBJECTS_V, BLASTED_OBJECTS_I);
class CExplosive :
public IDamageSource
{
private:
collide::rq_results rq_storage;
public:
CExplosive(void);
virtual ~CExplosive(void);
virtual void Load(LPCSTR section);
virtual void Load(CInifile const* ini, LPCSTR section);
virtual void net_Destroy();
virtual void net_Relcase(CObject* O);
virtual void UpdateCL();
private:
virtual void Explode();
public:
virtual void ExplodeParams(const Fvector& pos, const Fvector& dir);
static float ExplosionEffect(collide::rq_results& storage, CExplosive* exp_obj, CPhysicsShellHolder* blasted_obj,
const Fvector& expl_centre, const float expl_radius);
virtual void OnEvent(NET_Packet& P, u16 type); //{inherited::OnEvent( P, type);}
virtual void OnAfterExplosion();
virtual void OnBeforeExplosion();
virtual void SetCurrentParentID(u16 parent_id) { m_iCurrentParentID = parent_id; }
IC u16 CurrentParentID() const { return m_iCurrentParentID; }
virtual void SetInitiator(u16 id) { SetCurrentParentID(id); }
virtual u16 Initiator();
virtual void UpdateExplosionPos()
{
}
virtual void GetExplVelocity(Fvector& v);
virtual void GetExplPosition(Fvector& p);
virtual void GetExplDirection(Fvector& d);
virtual void GenExplodeEvent(const Fvector& pos, const Fvector& normal);
virtual void FindNormal(Fvector& normal);
virtual CGameObject* cast_game_object() =0;
virtual CExplosive* cast_explosive() { return this; }
virtual IDamageSource* cast_IDamageSource() { return this; }
virtual void GetRayExplosionSourcePos(Fvector& pos);
virtual void GetExplosionBox(Fvector& size);
virtual void ActivateExplosionBox(const Fvector& size, Fvector& in_out_pos);
void SetExplosionSize(const Fvector& new_size);
virtual bool Useful() const;
protected:
bool IsSoundPlaying() { return !!m_layered_sounds.FindSoundItem("sndExplode", true)->playing(); }
bool IsExploded() { return !!m_explosion_flags.test(flExploded); }
public:
bool IsExploding() { return !!m_explosion_flags.test(flExploding); }
private:
void PositionUpdate();
static void GetRaySourcePos(CExplosive* exp_obj, const Fvector& expl_centre, Fvector& p);
void ExplodeWaveProcessObject(collide::rq_results& storage, CPhysicsShellHolder* sh);
void ExplodeWaveProcess();
static float TestPassEffect(const Fvector& source_p, const Fvector& dir, float range, float ef_radius,
collide::rq_results& storage, CObject* blasted_obj);
void LightCreate();
void LightDestroy();
protected:
HUD_SOUND_COLLECTION_LAYERED m_layered_sounds;
CWalmarkManager m_wallmark_manager;
//ID ��������� ������� ���������� ��������
u16 m_iCurrentParentID;
//bool m_bReadyToExplode;
Fvector m_vExplodePos;
Fvector m_vExplodeSize;
Fvector m_vExplodeDir;
//��������� ������
float m_fBlastHit;
float m_fBlastHitImpulse;
float m_fBlastRadius;
//��������� � ���������� ��������
float m_fFragsRadius;
float m_fFragHit;
float m_fFragHitImpulse;
int m_iFragsNum;
//���� ��������� �����
ALife::EHitType m_eHitTypeBlast;
ALife::EHitType m_eHitTypeFrag;
//������ �������� �������� ����� �������� ������
float m_fUpThrowFactor;
//������ ���������� ��������
BLASTED_OBJECTS_V m_blasted_objects;
//������� ����������������� ������
float m_fExplodeDuration;
//����� ����� ������
float m_fExplodeDurationMax;
//�����, ����� ������� ���� ������� ���������� ��������, ���� ��� �� ���������� ��������� �� ����� ������
float m_fExplodeHideDurationMax;
//���� ��������� ������
enum
{
flExploding =1 << 0,
flExplodEventSent =1 << 1,
flReadyToExplode =1 << 2,
flExploded =1 << 3
};
Flags8 m_explosion_flags;
///////////////////////////////////////////////
//������ �� ������ ���� ����� ����� ������: true - ��� ���� ����� ������� �������
BOOL m_bHideInExplosion;
bool m_bAlreadyHidden;
virtual void HideExplosive();
//bool m_bExploding;
//bool m_bExplodeEventSent;
//////////////////////////////////////////////
//��� ������� ��������
float m_fFragmentSpeed;
//�����
ESoundTypes m_eSoundExplode;
//������ ������� �� ������
float fWallmarkSize;
//������� � ���������
shared_str m_sExplodeParticles;
//��������� ������
ref_light m_pLight;
Fcolor m_LightColor;
float m_fLightRange;
float m_fLightTime;
// momopate: Extended shrapnel customization
float m_fFragAP;
float m_fFragAirRes;
bool m_bFragTracer;
bool m_bFrag4to1Tracer;
bool m_bFragMagneticBeamShot;
bool m_bFragAllowRicochet;
u8 u8FragColorID;
virtual void StartLight();
virtual void StopLight();
BOOL m_bDynamicParticles;
CParticlesObject* m_pExpParticle;
virtual void UpdateExplosionParticles();
// ��������
struct
{
shared_str effect_sect_name;
} effector;
DECLARE_SCRIPT_REGISTER_FUNCTION
// Check sounds exist for custom sounds
bool SoundExist(LPCSTR section, LPCSTR sound_name);
};
add_to_type_list(CExplosive)
#undef script_type_list
#define script_type_list save_type_list(CExplosive)
IC void random_point_in_object_box(Fvector& out_pos, CObject* obj)
{
const Fbox& l_b1 = obj->BoundingBox();
Fvector l_c, l_d;
l_b1.get_CD(l_c, l_d);
out_pos.random_point(l_d);
obj->XFORM().transform_tiny(out_pos);
out_pos.add(l_c);
}