Effect_Blood can now take 'color' as a parameter. Also added some basic

trails which will be shoved into the client-side asap.
This commit is contained in:
Marco Cawthorne 2020-03-24 11:20:21 +01:00
parent bc5fcf6913
commit 223d740448
19 changed files with 174 additions and 32 deletions

View file

@ -492,17 +492,17 @@ CSQC_Parse_Event(void)
break;
case EV_BLOOD:
vector vBloodPos;
vector vBloodAngle;
vector vBloodColor;
vBloodPos[0] = readcoord();
vBloodPos[1] = readcoord();
vBloodPos[2] = readcoord();
vBloodAngle[0] = readcoord();
vBloodAngle[1] = readcoord();
vBloodAngle[2] = readcoord();
vBloodColor[0] = readbyte() / 255;
vBloodColor[1] = readbyte() / 255;
vBloodColor[2] = readbyte() / 255;
Effect_CreateBlood(vBloodPos, vBloodAngle);
Effect_CreateBlood(vBloodPos, vBloodColor);
break;
case EV_EXPLOSION:
vector vExploPos;

View file

@ -74,7 +74,7 @@ TraceAttack_FireSingle(vector vPos, vector vAngle, int iDamage, int iWeapon)
}
if (trace_ent.iBleeds == TRUE) {
Effect_CreateBlood(trace_endpos, [0,0,0]);
Effect_CreateBlood(trace_endpos, [1,0,0]);
return;
}

View file

@ -151,21 +151,21 @@ Effect_CreateExplosion(vector vPos)
#endif
}
void Effect_CreateBlood(vector vPos, vector vAngle) {
void Effect_CreateBlood(vector pos, vector color) {
#ifdef SSQC
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
WriteByte(MSG_MULTICAST, EV_BLOOD);
WriteCoord(MSG_MULTICAST, vPos[0]);
WriteCoord(MSG_MULTICAST, vPos[1]);
WriteCoord(MSG_MULTICAST, vPos[2]);
WriteCoord(MSG_MULTICAST, vAngle[0]);
WriteCoord(MSG_MULTICAST, vAngle[1]);
WriteCoord(MSG_MULTICAST, vAngle[2]);
WriteCoord(MSG_MULTICAST, pos[0]);
WriteCoord(MSG_MULTICAST, pos[1]);
WriteCoord(MSG_MULTICAST, pos[2]);
WriteByte(MSG_MULTICAST, color[0] * 255);
WriteByte(MSG_MULTICAST, color[1] * 255);
WriteByte(MSG_MULTICAST, color[2] * 255);
msg_entity = self;
multicast(vPos, MULTICAST_PVS);
multicast(pos, MULTICAST_PVS);
#else
sprite eBlood = spawn(sprite);
setorigin(eBlood, vPos);
setorigin(eBlood, pos);
setmodel(eBlood, "sprites/bloodspray.spr");
//eExplosion.think = Effect_CreateExplosion_Animate;
@ -173,14 +173,14 @@ void Effect_CreateBlood(vector vPos, vector vAngle) {
eBlood.drawmask = MASK_ENGINE;
eBlood.maxframe = modelframecount(eBlood.modelindex);
eBlood.loops = 0;
eBlood.scale = 0.5f;
eBlood.colormod = [1,0,0];
eBlood.scale = 1.0f;
eBlood.colormod = color;
eBlood.framerate = 20;
eBlood.nextthink = time + 0.05f;
for (int i = 0; i < 3; i++) {
sprite ePart = spawn(sprite);
setorigin(ePart, vPos);
setorigin(ePart, pos);
setmodel(ePart, "sprites/blood.spr");
ePart.movetype = MOVETYPE_BOUNCE;
ePart.gravity = 0.5f;
@ -188,7 +188,7 @@ void Effect_CreateBlood(vector vPos, vector vAngle) {
ePart.drawmask = MASK_ENGINE;
ePart.maxframe = modelframecount(ePart.modelindex);
ePart.loops = 0;
ePart.colormod = [1,0,0];
ePart.colormod = color;
ePart.framerate = 15;
ePart.nextthink = time + 0.1f;
ePart.velocity = randomvec() * 64;

View file

@ -144,7 +144,7 @@ w_knife_primary(void)
/* don't bother with decals, we got squibs */
if (trace_ent.iBleeds) {
Effect_CreateBlood(trace_endpos, [0,0,0]);
Effect_CreateBlood(trace_endpos, [1,0,0]);
} else {
Effect_Impact(IMPACT_MELEE, trace_endpos, trace_plane_normal);
}

View file

@ -142,7 +142,7 @@ w_pipewrench_primary(void)
/* don't bother with decals, we got squibs */
if (trace_ent.iBleeds) {
Effect_CreateBlood(trace_endpos, [0,0,0]);
Effect_CreateBlood(trace_endpos, [1,0,0]);
} else {
Effect_Impact(IMPACT_MELEE, trace_endpos, trace_plane_normal);
}
@ -219,7 +219,7 @@ w_pipewrench_release(void)
/* don't bother with decals, we got squibs */
if (trace_ent.iBleeds) {
Effect_CreateBlood(trace_endpos, [0,0,0]);
Effect_CreateBlood(trace_endpos, [1,0,0]);
} else {
Effect_Impact(IMPACT_MELEE, trace_endpos, trace_plane_normal);
}

View file

@ -113,7 +113,7 @@ w_shockrifle_shoothornet(void)
}
if (other.iBleeds) {
Effect_CreateBlood(trace_endpos, [0,0,0]);
Effect_CreateBlood(trace_endpos, [1,0,0]);
} else {
Effect_CreateSpark(self.origin, trace_plane_normal);
}

View file

@ -130,7 +130,7 @@ w_shovel_primary(void)
/* don't bother with decals, we got squibs */
if (trace_ent.iBleeds) {
Effect_CreateBlood(trace_endpos, [0,0,0]);
Effect_CreateBlood(trace_endpos, [1,0,0]);
} else {
Effect_Impact(IMPACT_MELEE, trace_endpos, trace_plane_normal);
}

View file

@ -122,7 +122,7 @@ w_spanner_primary(void)
/* don't bother with decals, we got squibs */
if (trace_ent.iBleeds) {
Effect_CreateBlood(trace_endpos, [0,0,0]);
Effect_CreateBlood(trace_endpos, [1,0,0]);
} else {
Effect_Impact(IMPACT_MELEE, trace_endpos, trace_plane_normal);
}

View file

@ -130,7 +130,7 @@ w_crowbar_primary(void)
/* don't bother with decals, we got squibs */
if (trace_ent.iBleeds) {
Effect_CreateBlood(trace_endpos, [0,0,0]);
Effect_CreateBlood(trace_endpos, [1,0,0]);
} else {
Effect_Impact(IMPACT_MELEE, trace_endpos, trace_plane_normal);
}

View file

@ -133,7 +133,7 @@ w_umbrella_primary(void)
/* don't bother with decals, we got squibs */
if (trace_ent.iBleeds) {
Effect_CreateBlood(trace_endpos, [0,0,0]);
Effect_CreateBlood(trace_endpos, [1,0,0]);
} else {
Effect_Impact(IMPACT_MELEE, trace_endpos, trace_plane_normal);
}

View file

@ -123,7 +123,7 @@ w_wrench_primary(void)
/* don't bother with decals, we got squibs */
if (trace_ent.iBleeds) {
Effect_CreateBlood(trace_endpos, [0,0,0]);
Effect_CreateBlood(trace_endpos, [1,0,0]);
} else {
Effect_Impact(IMPACT_MELEE, trace_endpos, trace_plane_normal);
}

View file

@ -140,7 +140,7 @@ void Crossbolt_Touch(void) {
if (other.iBleeds == FALSE) {
Effect_CreateSpark(self.origin, trace_plane_normal);
} else {
Effect_CreateBlood(self.origin, [0,0,0]);
Effect_CreateBlood(self.origin, [1,0,0]);
}
remove(self);
}

View file

@ -130,7 +130,7 @@ w_crowbar_primary(void)
/* don't bother with decals, we got squibs */
if (trace_ent.iBleeds) {
Effect_CreateBlood(trace_endpos, [0,0,0]);
Effect_CreateBlood(trace_endpos, [1,0,0]);
} else {
Effect_Impact(IMPACT_MELEE, trace_endpos, trace_plane_normal);
}

View file

@ -35,6 +35,14 @@ w_hornetgun_precache(void)
precache_sound("agrunt/ag_fire1.wav");
precache_sound("agrunt/ag_fire2.wav");
precache_sound("agrunt/ag_fire3.wav");
precache_sound("hornet/ag_buzz1.wav");
precache_sound("agrunt/ag_buzz2.wav");
precache_sound("agrunt/ag_buzz3.wav");
precache_sound("hornet/ag_hornethit1.wav");
precache_sound("hornet/ag_hornethit2.wav");
precache_sound("hornet/ag_hornethit3.wav");
}
int
@ -94,9 +102,14 @@ void
w_hornetgun_shoothornet(void)
{
static void Hornet_Touch(void) {
int r = floor(random(1,4));
if (other.takedamage == DAMAGE_YES) {
Damage_Apply(other, self.owner, 10, WEAPON_HORNETGUN, DMG_GENERIC);
string sample = sprintf("hornet/ag_hornethit%i.wav", r);
} else {
string sample = sprintf("hornet/ag_buzz%i.wav", r);
}
sound(self, CHAN_BODY, sample, 1, ATTN_NORM);
remove(self);
}
@ -112,6 +125,7 @@ w_hornetgun_shoothornet(void)
bolt.gravity = 0.5f;
bolt.angles = vectoangles(bolt.velocity);
bolt.touch = Hornet_Touch;
bolt.traileffectnum = particleeffectnum("weapon_hornet.trail");
setsize(bolt, [0,0,0], [0,0,0]);
}
#endif

View file

@ -89,7 +89,28 @@ void w_rpg_holster(void)
void w_rpg_release(void)
{
player pl = (player)self;
if (pl.w_idle_next > 0.0) {
return;
}
int r = (float)input_sequence % 3;
if (pl.a_ammo1 > 0) {
if (r == 1) {
Weapons_ViewAnimation(RPG_FIDGET);
} else {
Weapons_ViewAnimation(RPG_IDLE);
}
} else {
if (r == 1) {
Weapons_ViewAnimation(RPG_FIDGET_UL);
} else {
Weapons_ViewAnimation(RPG_IDLE_UL);
}
}
pl.w_idle_next = 6.0f;
}
void w_rpg_primary(void)
@ -150,6 +171,7 @@ void w_rpg_primary(void)
rocket.touch = Rocket_Touch;
rocket.think = Rocket_BuildSpeed;
rocket.nextthink = time + 0.15f;
rocket.traileffectnum = particleeffectnum("weapon_rpg.trail");
if (pl.a_ammo3 > 0) {
rocket.weapon = 1;

View file

@ -97,6 +97,7 @@ void w_snark_deploy(void)
float pit = 100 + random(0,10);
sound(self, CHAN_BODY, "squeek/sqk_deploy1.wav", 1.0, ATTN_NORM, pit);
Damage_Apply(trace_ent, self.goalentity, 10, WEAPON_SNARK, DMG_GENERIC);
Effect_CreateBlood(self.origin + [0,0,16], [1,0,0]);
}
if (self.aiment.health <= 0) {
@ -107,6 +108,7 @@ void w_snark_deploy(void)
runstandardplayerphysics(self);
}
static void snark_die(int i) {
Effect_CreateBlood(self.origin + [0,0,16], [203,183,15] / 255);
sound(self, CHAN_VOICE, "squeek/sqk_die1.wav", 1.0, ATTN_NORM);
sound(self, CHAN_BODY, "squeek/sqk_blast1.wav", 1.0, ATTN_NORM);
self.customphysics = __NULL__;
@ -131,7 +133,7 @@ void w_snark_deploy(void)
snark.takedamage = DAMAGE_YES;
snark.aiment = __NULL__;
snark.vDeath = snark_die;
snark.weapon = 3.0f;
snark.weapon = 1.0f;
}
#endif

View file

@ -0,0 +1,76 @@
r_part railtrailinner
{
step 30
scale 5
die 1
alpha 0.5
rgb 255 255 255
blend add
type beam
spawnvel 2 2
}
r_part railtrail240
{
step 15
scale 3
die 1
alpha 0
rgb 32 32 255
rampmode delta
ramp -255 -255 0 -2.5 0
ramp 0 0 0 0.65 0
ramp 0 0 0 0.65 0
ramp 0 0 0 0.65 0
ramp 0 0 -128 0.65 10
blend add
type beam
spawnmode spiral
spawnparam1 256
spawnparam2 240
spawnvel 12
assoc railtrailinner
}
r_part railtrail120
{
step 15
scale 3
die 1
alpha 0
rgb 32 32 255
rampmode delta
ramp -255 -255 0 -2.5 0
ramp 0 0 0 0.65 0
ramp 0 0 0 0.65 0
ramp 0 0 0 0.65 0
ramp 0 0 -128 0.65 10
blend add
type beam
spawnmode spiral
spawnparam1 256
spawnparam2 120
spawnvel 12
assoc railtrail240
}
r_part railtrail
{
step 15
scale 3
die 1
alpha 0
rgb 32 32 255
rampmode delta
ramp -255 -255 0 -2.5 0
ramp 0 0 0 0.65 0
ramp 0 0 0 0.65 0
ramp 0 0 0 0.65 0
ramp 0 0 -128 0.65 10
blend add
type beam
spawnmode spiral
spawnparam1 256
spawnvel 12
assoc railtrail120
}

View file

@ -0,0 +1,14 @@
r_part trail
{
texture "particles/fteparticlefont.tga"
tcoords 97 97 191 191 256
scale 2
scaledelta 0.25
rgbf 1 0.5 0
alpha 0.5
blend add
step 4
die 1
randomvel 0
type beam
}

View file

@ -0,0 +1,14 @@
r_part trail
{
texture "particles/fteparticlefont.tga"
tcoords 97 97 191 191 256
scale 2
scaledelta 0.25
rgbf 1 1 1
alpha 0.5
blend add
step 4
die 2
randomvel 0
type beam
}