-
Notifications
You must be signed in to change notification settings - Fork 3
/
colored_weapon_trails.patch
103 lines (97 loc) · 4.83 KB
/
colored_weapon_trails.patch
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
Index: src/fpsgame/weapon.cpp
===================================================================
--- src/fpsgame/weapon.cpp (revision 6519)
+++ src/fpsgame/weapon.cpp (working copy)
@@ -228,6 +228,8 @@
adddecal(DECAL_BLOOD, vec(b->o).sub(vec(surface).mul(b->radius)), surface, 2.96f/b->bounces, bvec(0x60, 0xFF, 0xFF), rnd(4));
}
+ MOD(HVARP, trailcolorgrenadelauncher, 0, 0x404040, 0xFFFFFF);
+
void updatebouncers(int time)
{
loopv(bouncers)
@@ -236,7 +238,7 @@
if(bnc.bouncetype==BNC_GRENADE && bnc.vel.magnitude() > 50.0f)
{
vec pos = bnc.offsetpos();
- regular_particle_splash(PART_SMOKE, 1, 150, pos, 0x404040, 2.4f, 50, -20);
+ regular_particle_splash(PART_SMOKE, 1, 150, pos, trailcolorgrenadelauncher, 2.4f, 50, -20);
}
vec old(bnc.o);
bool stopped = false;
@@ -520,6 +522,8 @@
return true;
}
+ MOD(HVARP, trailcolorrocketlauncher, 0, 0x404040, 0xFFFFFF);
+
void updateprojectiles(int time)
{
loopv(projs)
@@ -570,7 +574,7 @@
}
particle_splash(guns[p.gun].part, 1, 1, pos, color, 4.8f, 150, 20);
}
- else regular_particle_splash(PART_SMOKE, 2, 300, pos, 0x404040, 2.4f, 50, -20);
+ else regular_particle_splash(PART_SMOKE, 2, 300, pos, p.gun==GUN_RL ? trailcolorrocketlauncher : 0x404040, 2.4f, 50, -20);
}
}
if(exploded)
@@ -588,6 +592,10 @@
VARP(muzzleflash, 0, 1, 1);
VARP(muzzlelight, 0, 1, 1);
+ MOD(HVARP, trailcolorshotgun, 0, 0xFFC864, 0xFFFFFF);
+ MOD(HVARP, trailcolorchaingun, 0, 0xFFC864, 0xFFFFFF);
+ MOD(HVARP, trailcolorrifle, 0, 0x404040, 0xFFFFFF);
+ MOD(HVARP, trailcolorpistol, 0, 0xFFC864, 0xFFFFFF);
void shoteffects(int gun, const vec &from, const vec &to, fpsent *d, bool local, int id, int prevaction) // create visual effect from a shot
{
@@ -606,7 +614,7 @@
loopi(guns[gun].rays)
{
particle_splash(PART_SPARK, 20, 250, rays[i], 0xB49B4B, 0.24f);
- particle_flare(hudgunorigin(gun, from, rays[i], d), rays[i], 300, PART_STREAK, 0xFFC864, 0.28f);
+ particle_flare(hudgunorigin(gun, from, rays[i], d), rays[i], 300, PART_STREAK, trailcolorshotgun, 0.28f);
if(!local) adddecal(DECAL_BULLET, rays[i], vec(from).sub(rays[i]).safenormalize(), 2.0f);
}
if(muzzlelight) adddynlight(hudgunorigin(gun, d->o, to, d), 30, vec(0.5f, 0.375f, 0.25f), 100, 100, DL_FLASH, 0, vec(0, 0, 0), d);
@@ -617,7 +625,7 @@
case GUN_PISTOL:
{
particle_splash(PART_SPARK, 200, 250, to, 0xB49B4B, 0.24f);
- particle_flare(hudgunorigin(gun, from, to, d), to, 600, PART_STREAK, 0xFFC864, 0.28f);
+ particle_flare(hudgunorigin(gun, from, to, d), to, 600, PART_STREAK, gun==GUN_CG ? trailcolorchaingun : trailcolorpistol, 0.28f);
if(muzzleflash && d->muzzle.x >= 0)
particle_flare(d->muzzle, d->muzzle, gun==GUN_CG ? 100 : 200, PART_MUZZLE_FLASH1, 0xFFFFFF, gun==GUN_CG ? 2.25f : 1.25f, d);
if(!local) adddecal(DECAL_BULLET, to, vec(from).sub(to).safenormalize(), 2.0f);
@@ -650,7 +658,7 @@
case GUN_RIFLE:
particle_splash(PART_SPARK, 200, 250, to, 0xB49B4B, 0.24f);
- particle_trail(PART_SMOKE, 500, hudgunorigin(gun, from, to, d), to, 0x404040, 0.6f, 20);
+ particle_trail(PART_SMOKE, 500, hudgunorigin(gun, from, to, d), to, trailcolorrifle, 0.6f, 20);
if(muzzleflash && d->muzzle.x >= 0)
particle_flare(d->muzzle, d->muzzle, 150, PART_MUZZLE_FLASH3, 0xFFFFFF, 1.25f, d);
if(!local) adddecal(DECAL_BULLET, to, vec(from).sub(to).safenormalize(), 3.0f);
@@ -676,6 +684,19 @@
if(d->quadmillis && lastmillis-prevaction>200 && !looped) playsound(S_ITEMPUP, d==h ? NULL : &d->o);
}
+ ICOMMAND(settrailcolor, "sf", (char *name, float *color), {
+ if(!color) return;
+ switch (getweapon(name))
+ {
+ case GUN_SG: trailcolorshotgun = *color; break;
+ case GUN_CG: trailcolorchaingun = *color; break;
+ case GUN_RL: trailcolorrocketlauncher = *color; break;
+ case GUN_RIFLE: trailcolorrifle = *color; break;
+ case GUN_GL: trailcolorgrenadelauncher = *color; break;
+ case GUN_PISTOL: trailcolorpistol = *color; break;
+ }
+ });
+
void particletrack(physent *owner, vec &o, vec &d)
{
if(owner->type!=ENT_PLAYER && owner->type!=ENT_AI) return;
@@ -1000,4 +1021,3 @@
}
}
};
-