︙ | | | ︙ | |
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
(a3.length > 0 ? a3.cube_intValue : -1));
})
// create random spread of rays for the shotgun
void
createrays(const OFVector3D *from, const OFVector3D *to)
{
vdist(dist, dvec, *from, *to);
float f = dist * SGSPREAD / 1000;
for (int i = 0; i < SGRAYS; i++)
#define RNDD (rnd(101) - 50) * f
sg[i] = OFAddVectors3D(*to, OFMakeVector3D(RNDD, RNDD, RNDD));
}
// if lineseg hits entity bounding box
|
|
|
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
(a3.length > 0 ? a3.cube_intValue : -1));
})
// create random spread of rays for the shotgun
void
createrays(const OFVector3D *from, const OFVector3D *to)
{
float dist = OFDistanceOfVectors3D(*from, *to);
float f = dist * SGSPREAD / 1000;
for (int i = 0; i < SGRAYS; i++)
#define RNDD (rnd(101) - 50) * f
sg[i] = OFAddVectors3D(*to, OFMakeVector3D(RNDD, RNDD, RNDD));
}
// if lineseg hits entity bounding box
|
︙ | | | ︙ | |
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
|
static void
radialeffect(
DynamicEntity *o, const OFVector3D *v, int cn, int qdam, DynamicEntity *at)
{
if (o.state != CS_ALIVE)
return;
vdist(dist, temp, *v, o.origin);
dist -= 2; // account for eye distance imprecision
if (dist < RL_DAMRAD) {
if (dist < 0)
dist = 0;
int damage = (int)(qdam * (1 - (dist / RL_DAMRAD)));
hit(cn, damage, o, at);
temp =
OFMultiplyVector3D(temp, (RL_DAMRAD - dist) * damage / 800);
o.velocity = OFAddVectors3D(o.velocity, temp);
}
}
static void
|
|
>
>
>
>
>
>
|
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
|
static void
radialeffect(
DynamicEntity *o, const OFVector3D *v, int cn, int qdam, DynamicEntity *at)
{
if (o.state != CS_ALIVE)
return;
OFVector3D origin = o.origin;
float dist = OFDistanceOfVectors3D(*v, origin);
OFVector3D temp = OFSubtractVectors3D(*v, origin);
dist -= 2; // account for eye distance imprecision
if (dist < RL_DAMRAD) {
if (dist < 0)
dist = 0;
int damage = (int)(qdam * (1 - (dist / RL_DAMRAD)));
hit(cn, damage, o, at);
temp =
OFMultiplyVector3D(temp, (RL_DAMRAD - dist) * damage / 800);
o.velocity = OFAddVectors3D(o.velocity, temp);
}
}
static void
|
︙ | | | ︙ | |
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
|
if (!p.inuse)
continue;
int qdam = guns[p.gun].damage * (p.owner.quadMillis ? 4 : 1);
if ([p.owner isKindOfClass:Monster.class])
qdam /= MONSTERDAMAGEFACTOR;
vdist(dist, v, p.o, p.to);
float dtime = dist * 1000 / p.speed;
if (time > dtime)
dtime = time;
v = OFMultiplyVector3D(v, time / dtime);
v = OFAddVectors3D(v, p.o);
if (p.local) {
for (id player in players)
|
|
>
>
|
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
|
if (!p.inuse)
continue;
int qdam = guns[p.gun].damage * (p.owner.quadMillis ? 4 : 1);
if ([p.owner isKindOfClass:Monster.class])
qdam /= MONSTERDAMAGEFACTOR;
OFVector3D po = p.o, pto = pto;
float dist = OFDistanceOfVectors3D(po, pto);
OFVector3D v = OFSubtractVectors3D(po, pto);
float dtime = dist * 1000 / p.speed;
if (time > dtime)
dtime = time;
v = OFMultiplyVector3D(v, time / dtime);
v = OFAddVectors3D(v, p.o);
if (p.local) {
for (id player in players)
|
︙ | | | ︙ | |
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
|
}
void
hitpush(int target, int damage, DynamicEntity *d, DynamicEntity *at,
const OFVector3D *from, const OFVector3D *to)
{
hit(target, damage, d, at);
vdist(dist, v, *from, *to);
v = OFMultiplyVector3D(v, damage / dist / 50);
d.velocity = OFAddVectors3D(d.velocity, v);
}
void
raydamage(DynamicEntity *o, const OFVector3D *from, const OFVector3D *to,
DynamicEntity *d, int i)
|
|
>
|
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
|
}
void
hitpush(int target, int damage, DynamicEntity *d, DynamicEntity *at,
const OFVector3D *from, const OFVector3D *to)
{
hit(target, damage, d, at);
float dist = OFDistanceOfVectors3D(*from, *to);
OFVector3D v = OFSubtractVectors3D(*from, *to);
v = OFMultiplyVector3D(v, damage / dist / 50);
d.velocity = OFAddVectors3D(d.velocity, v);
}
void
raydamage(DynamicEntity *o, const OFVector3D *from, const OFVector3D *to,
DynamicEntity *d, int i)
|
︙ | | | ︙ | |
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
|
}
if (d.gunSelect)
d.ammo[d.gunSelect]--;
OFVector3D from = d.origin;
OFVector3D to = *targ;
from.z -= 0.2f; // below eye
vdist(dist, unitv, from, to);
unitv = OFMultiplyVector3D(unitv, 1.0f / dist);
OFVector3D kickback =
OFMultiplyVector3D(unitv, guns[d.gunSelect].kickamount * -0.01f);
d.velocity = OFAddVectors3D(d.velocity, kickback);
if (d.pitch < 80.0f)
d.pitch += guns[d.gunSelect].kickamount * 0.05f;
|
>
|
|
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
|
}
if (d.gunSelect)
d.ammo[d.gunSelect]--;
OFVector3D from = d.origin;
OFVector3D to = *targ;
from.z -= 0.2f; // below eye
float dist = OFDistanceOfVectors3D(from, to);
OFVector3D unitv = OFSubtractVectors3D(from, to);
unitv = OFMultiplyVector3D(unitv, 1.0f / dist);
OFVector3D kickback =
OFMultiplyVector3D(unitv, guns[d.gunSelect].kickamount * -0.01f);
d.velocity = OFAddVectors3D(d.velocity, kickback);
if (d.pitch < 80.0f)
d.pitch += guns[d.gunSelect].kickamount * 0.05f;
|
︙ | | | ︙ | |