Cube  Diff

Differences From Artifact [6b111961c9]:

To Artifact [acb2ec57ac]:


73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88

// 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;
	loopi(SGRAYS)
	{
#define RNDD (rnd(101) - 50) * f
		OFVector3D r = OFMakeVector3D(RNDD, RNDD, RNDD);
		sg[i] = *to;
		vadd(sg[i], r);
	}
}








|
<







73
74
75
76
77
78
79
80

81
82
83
84
85
86
87

// 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
		OFVector3D r = OFMakeVector3D(RNDD, RNDD, RNDD);
		sg[i] = *to;
		vadd(sg[i], r);
	}
}

164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
		p.local = local;
		p.owner = owner;
		p.gun = gun;
		return;
	}
}

void
hit(int target, int damage, __kindof DynamicEntity *d, DynamicEntity *at)
{
	OFVector3D o = d.origin;
	if (d == player1)
		selfdamage(damage, at == player1 ? -1 : -2, at);
	else if ([d isKindOfClass:Monster.class])
		[d incurDamage:damage fromEntity:at];







|







163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
		p.local = local;
		p.owner = owner;
		p.gun = gun;
		return;
	}
}

static void
hit(int target, int damage, __kindof DynamicEntity *d, DynamicEntity *at)
{
	OFVector3D o = d.origin;
	if (d == player1)
		selfdamage(damage, at == player1 ? -1 : -2, at);
	else if ([d isKindOfClass:Monster.class])
		[d incurDamage:damage fromEntity:at];
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
		int damage = (int)(qdam * (1 - (dist / RL_DAMRAD)));
		hit(cn, damage, o, at);
		vmul(temp, (RL_DAMRAD - dist) * damage / 800);
		vadd(o.velocity, temp);
	}
}

void
splash(Projectile *p, const OFVector3D *v, const OFVector3D *vold,
    int notthisplayer, int notthismonster, int qdam)
{
	particle_splash(0, 50, 300, v);
	p.inuse = false;

	if (p.gun != GUN_RL) {







|







200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
		int damage = (int)(qdam * (1 - (dist / RL_DAMRAD)));
		hit(cn, damage, o, at);
		vmul(temp, (RL_DAMRAD - dist) * damage / 800);
		vadd(o.velocity, temp);
	}
}

static void
splash(Projectile *p, const OFVector3D *v, const OFVector3D *vold,
    int notthisplayer, int notthismonster, int qdam)
{
	particle_splash(0, 50, 300, v);
	p.inuse = false;

	if (p.gun != GUN_RL) {
318
319
320
321
322
323
324

325
326
327
328
329
330
331
332
	playsound(guns[gun].sound, d == player1 ? NULL : &loc);
	int pspeed = 25;
	switch (gun) {
	case GUN_FIST:
		break;

	case GUN_SG: {

		loopi(SGRAYS) particle_splash(0, 5, 200, &sg[i]);
		break;
	}

	case GUN_CG:
		particle_splash(0, 100, 250, to);
		// particle_trail(1, 10, from, to);
		break;







>
|







317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
	playsound(guns[gun].sound, d == player1 ? NULL : &loc);
	int pspeed = 25;
	switch (gun) {
	case GUN_FIST:
		break;

	case GUN_SG: {
		for (int i = 0; i < SGRAYS; i++)
			particle_splash(0, 5, 200, &sg[i]);
		break;
	}

	case GUN_CG:
		particle_splash(0, 100, 250, to);
		// particle_trail(1, 10, from, to);
		break;
367
368
369
370
371
372
373

374

375
376
377
378
379
380
381
	int qdam = guns[d.gunSelect].damage;
	if (d.quadMillis)
		qdam *= 4;
	if ([d isKindOfClass:Monster.class])
		qdam /= MONSTERDAMAGEFACTOR;
	if (d.gunSelect == GUN_SG) {
		int damage = 0;

		loop(r, SGRAYS) if (intersect(o, from, &sg[r])) damage += qdam;

		if (damage)
			hitpush(i, damage, o, d, from, to);
	} else if (intersect(o, from, to))
		hitpush(i, qdam, o, d, from, to);
}

void







>
|
>







367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
	int qdam = guns[d.gunSelect].damage;
	if (d.quadMillis)
		qdam *= 4;
	if ([d isKindOfClass:Monster.class])
		qdam /= MONSTERDAMAGEFACTOR;
	if (d.gunSelect == GUN_SG) {
		int damage = 0;
		for (int r = 0; r < SGRAYS; r++)
			if (intersect(o, from, &sg[r]))
				damage += qdam;
		if (damage)
			hitpush(i, damage, o, d, from, to);
	} else if (intersect(o, from, to))
		hitpush(i, qdam, o, d, from, to);
}

void