-
Notifications
You must be signed in to change notification settings - Fork 1
/
AmmoParams.h
151 lines (122 loc) · 3.01 KB
/
AmmoParams.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
#ifndef __AMMOPARAMS_H__
#define __AMMOPARAMS_H__
#pragma once
#include <IItemSystem.h>
#include <IWeapon.h>
struct SScaledEffectParams
{
const char* ppname;
float radius;
float delay;
float fadeInTime;
float fadeOutTime;
float maxValue;
float aiObstructionRadius;
SScaledEffectParams(const IItemParamsNode* scaledEffect);
};
struct SCollisionParams
{
IParticleEffect* pParticleEffect;
const char* sound;
float scale;
SCollisionParams(const IItemParamsNode* collision);
~SCollisionParams();
};
struct SExplosionParams
{
float minRadius;
float maxRadius;
float minPhysRadius;
float maxPhysRadius;
float pressure;
float holeSize;
float terrainHoleSize;
IParticleEffect* pParticleEffect;
const char *effectName;
float effectScale;
string type;
uint8 hitTypeId;
float maxblurdist;
SExplosionParams(const IItemParamsNode* explosion);
~SExplosionParams();
};
struct SFlashbangParams
{
float maxRadius;
float blindAmount;
float flashbangBaseTime;
SFlashbangParams(const IItemParamsNode* flashbang);
};
struct STrailParams
{
const char* sound;
const char* effect;
const char* effect_fp;
float scale;
bool prime;
STrailParams(const IItemParamsNode* trail);
};
struct SWhizParams
{
const char* sound;
float speed;
SWhizParams(const IItemParamsNode* whiz);
};
// this structure holds cached XML attributes for fast acccess
struct SAmmoParams
{
//flags
uint32 flags;
bool serverSpawn;
bool predictSpawn;
bool reusable;
// common parameters
float lifetime;
float showtime;
uint16 aiType;
int bulletType;
int hitPoints;
bool noBulletHits;
bool quietRemoval;
float sleepTime;
// physics parameters
EPhysicalizationType physicalizationType;
float mass;
float speed;
int maxLoggedCollisions;
bool traceable;
Vec3 spin;
Vec3 spinRandom;
ISurfaceType* pSurfaceType;
pe_params_particle* pParticleParams;
// firstperson geometry
string fpGeometryName;
mutable bool fpGeometryIsCached; //Need to modify in a const function ;/
Matrix34 fpLocalTM;
SScaledEffectParams* pScaledEffect;
SCollisionParams* pCollision;
SExplosionParams* pExplosion;
SFlashbangParams* pFlashbang;
SWhizParams* pWhiz;
SWhizParams* pRicochet;
STrailParams* pTrail;
STrailParams* pTrailUnderWater;
const IEntityClass* pEntityClass;
const IItemParamsNode* pItemParams;
SAmmoParams(const IItemParamsNode* pItemParams_ = 0, const IEntityClass* pEntityClass_=0);
~SAmmoParams();
void Init(const IItemParamsNode* pItemParams_, const IEntityClass* pEntityClass_);
void CacheGeometry() const;
void ResetCacheGeometry() const { fpGeometryIsCached = false; };
int GetMemorySize() const;
private:
void LoadFlagsAndParams();
void LoadPhysics();
void LoadGeometry();
void LoadScaledEffect();
void LoadCollision();
void LoadExplosion();
void LoadFlashbang();
void LoadTrailsAndWhizzes();
};
#endif//__AMMOPARAMS_H__