32#define P_BOUNCE_TOUCH 0x00000001
33#define P_CHARGE_LIFE 0x00000002
34#define P_CHARGE_SPEED 0x00000004
35#define P_NO_TOUCH_DAMAGE 0x00000008
36#define P_FUSE 0x00000010
38extern Event EV_Projectile_Explode;
39extern Event EV_Projectile_UpdateBeam;
44class Projectile :
public Animate
47 CLASS_PROTOTYPE( Projectile );
58 float charge_fraction;
63 meansOfDeath_t meansofdeath;
67 str bouncesound_metal;
69 str bouncesound_water;
70 float fLastBounceTime;
72 str impactmarkorientation;
73 float impactmarkradius;
75 SafePtr<Entity> target;
78 bool addownervelocity;
80 bool remove_when_stopped;
81 bool m_bExplodeOnTouch;
82 bool m_bHurtOwnerOnly;
83 int m_iSmashThroughGlass;
94 bool m_bHadPlayerOwner;
95 SafePtr<Entity> m_pOwnerPtr;
98 void Archive(
Archiver &arc )
override;
99 virtual void Touch( Event *ev );
100 virtual void Explode( Event *ev );
101 virtual void DoDecal(
void );
103 void SetAvelocity( Event *ev );
104 void SetAddVelocity( Event *ev );
105 void SetDLight( Event *ev );
106 void SetLife( Event *ev );
107 void SetDMLife( Event *ev );
108 void SetMinLife( Event *ev );
109 void SetChargeLife( Event *ev );
110 void SetFuse( Event *ev );
111 void SetSpeed( Event *ev );
112 void SetMinSpeed( Event *ev );
113 void SetChargeSpeed( Event *ev );
114 void SetDamage( Event *ev );
115 void SetKnockback( Event *ev );
116 void SetProjectileDLight( Event *ev );
117 void SetMeansOfDeath( Event *ev );
118 void SetBounceTouch( Event *ev );
119 void SetBounceSound( Event *ev );
120 void SetBounceSoundMetal( Event *ev );
121 void SetBounceSoundHard( Event *ev );
122 void SetBounceSoundWater( Event *ev );
123 void SetNoTouchDamage( Event *ev );
124 void SetImpactMarkShader( Event *ev );
125 void SetImpactMarkRadius( Event *ev );
126 void SetImpactMarkOrientation( Event *ev );
127 void SetExplosionModel( Event *ev );
128 void SetSmashThroughGlass( Event *ev );
129 void UpdateBeam( Event *ev );
130 void BeamCommand( Event *ev );
131 void HeatSeek( Event *ev );
132 void Drunk( Event *ev );
133 void SmashThroughGlassThink( Event *ev );
134 void SmashThroughGlassThink();
135 void AddOwnerVelocity( Event *ev );
136 void Prethink( Event *ev );
137 float ResolveMinimumDistance( Entity *potential_target,
float currmin );
138 float AdjustAngle(
float maxadjust,
float currangle,
float targetangle );
139 void SetCanHitOwner( Event *ev );
140 void ClearOwner( Event *ev );
141 void RemoveWhenStopped( Event *ev );
142 void ExplodeOnTouch( Event *ev );
143 void Stopped( Event *ev );
144 void Think()
override;
146 void SetOwner(Entity* owner);
147 void SetMartyr(
int entnum );
148 void ArcToTarget(Event* ev);
149 void BecomeBomb(Event* ev);
150 void DieInWater(Event* ev);
154 bool CheckTeams(
void);
157inline void Projectile::SetMartyr(
int entnum)
160 m_bHurtOwnerOnly =
true;
163inline void Projectile::Archive
168 Animate::Archive( arc );
170 arc.ArchiveInteger( &owner );
171 arc.ArchiveFloat( &speed );
172 arc.ArchiveFloat( &minspeed );
173 arc.ArchiveFloat( &damage );
174 arc.ArchiveFloat( &knockback );
175 arc.ArchiveFloat( &life );
176 arc.ArchiveFloat( &dmlife );
177 arc.ArchiveFloat( &minlife );
178 arc.ArchiveFloat( &dlight_radius );
179 arc.ArchiveFloat( &charge_fraction );
180 arc.ArchiveVector( &dlight_color );
181 arc.ArchiveVector( &addvelocity );
182 ArchiveEnum( meansofdeath, meansOfDeath_t );
183 arc.ArchiveObjectPointer( ( Class ** )&m_beam );
184 arc.ArchiveInteger( &projFlags );
185 arc.ArchiveString( &bouncesound );
186 arc.ArchiveString( &bouncesound_metal );
187 arc.ArchiveString( &bouncesound_hard );
188 arc.ArchiveString( &bouncesound_water );
189 arc.ArchiveFloat( &fLastBounceTime );
190 arc.ArchiveString( &impactmarkshader );
191 arc.ArchiveString( &impactmarkorientation );
192 arc.ArchiveFloat( &impactmarkradius );
193 arc.ArchiveString( &explosionmodel );
194 arc.ArchiveFloat( &fDrunk );
195 arc.ArchiveFloat( &fDrunkRate );
196 arc.ArchiveBool( &addownervelocity );
197 arc.ArchiveBool( &can_hit_owner );
198 arc.ArchiveBool( &remove_when_stopped );
199 arc.ArchiveBool( &m_bExplodeOnTouch );
200 arc.ArchiveBool( &m_bHurtOwnerOnly );
203class Explosion :
public Projectile
217 CLASS_PROTOTYPE( Explosion );
220 qboolean constant_damage;
221 qboolean damage_every_frame;
224 void SetRadius( Event *ev );
225 void SetRadiusDamage( Event *ev );
226 void SetConstantDamage( Event *ev );
227 void SetDamageEveryFrame( Event *ev );
228 void SetFlash( Event *ev );
229 void MakeExplosionEffect( Event *ev );
231 void DamageAgain( Event *ev );
233 void Archive(
Archiver &arc )
override;
236inline void Explosion::Archive
241 Projectile::Archive( arc );
243 arc.ArchiveFloat( &flash_r );
244 arc.ArchiveFloat( &flash_g );
245 arc.ArchiveFloat( &flash_b );
246 arc.ArchiveFloat( &flash_a );
247 arc.ArchiveFloat( &flash_radius );
248 arc.ArchiveFloat( &flash_time );
249 arc.ArchiveInteger( &flash_type );
250 arc.ArchiveFloat( &radius_damage );
259 meansOfDeath_t means_of_death,
261 float attack_min_height,
262 float attack_max_height,
264 qboolean hit_dead =
true,
275 float real_speed = 0,
284 Vector dir = Vector( 0, 0, 0 ),
288 bool hurtOwnerOnly =
false
307 int iTracerFrequency,
309 float bulletthroughwood,
310 float bulletthroughmetal,
328 int iTracerFrequency,
361 qboolean constant_damage =
false,
363 bool hurtOwnerOnly =
false
366const char* G_LocationNumToDispString(
int iLocation);
367Entity* FindDefusableObject(
const Vector& dir,
Entity* owner,
float maxdist);
368void DefuseObject(
const Vector& dir,
Entity* owner,
float maxdist);
369qboolean CanPlaceLandmine(
const Vector& origin,
Entity* owner);
370void PlaceLandmine(
const Vector& origin,
Entity* owner,
const str& model,
Weapon* weap);
Definition weaputils.h:45