Extend impacts to the full spectrum of material definitions, sound shaders

and all. Still needs patch for Counter-Strike.
This commit is contained in:
Marco Cawthorne 2021-01-19 10:37:28 +01:00
parent 7e2aab4cad
commit f8606ae7e7
7 changed files with 388 additions and 103 deletions

View file

@ -28,21 +28,6 @@ step_alien.right
sample player/pl_step4.wav
}
step_bloodyflesh.left
{
attenuation static
footstep
sample player/pl_step1.wav
sample player/pl_step2.wav
}
step_bloodyflesh.right
{
attenuation static
footstep
sample player/pl_step3.wav
sample player/pl_step4.wav
}
step_computer.left
{
attenuation static

View file

@ -0,0 +1,161 @@
sfx_impact.default
{
attenuation normal
sample weapons/ric1.wav
sample weapons/ric2.wav
sample weapons/ric3.wav
sample weapons/ric4.wav
sample weapons/ric5.wav
}
sfx_impact.alien
{
attenuation normal
sample weapons/ric1.wav
sample weapons/ric2.wav
sample weapons/ric3.wav
sample weapons/ric4.wav
sample weapons/ric5.wav
}
sfx_impact.flesh
{
attenuation normal
sample debris/flesh1.wav
sample debris/flesh2.wav
sample debris/flesh3.wav
sample debris/flesh4.wav
sample debris/flesh5.wav
sample debris/flesh6.wav
sample debris/flesh7.wav
}
sfx_impact.foliage
{
attenuation normal
sample weapons/ric1.wav
sample weapons/ric2.wav
sample weapons/ric3.wav
sample weapons/ric4.wav
sample weapons/ric5.wav
}
sfx_impact.computer
{
attenuation normal
sample buttons/spark1.wav
sample buttons/spark2.wav
sample buttons/spark3.wav
sample buttons/spark4.wav
sample buttons/spark5.wav
sample buttons/spark6.wav
}
sfx_impact.dirt
{
attenuation normal
sample weapons/ric1.wav
sample weapons/ric2.wav
sample weapons/ric3.wav
sample weapons/ric4.wav
sample weapons/ric5.wav
}
sfx_impact.vent
{
attenuation normal
sample debris/metal1.wav
sample debris/metal2.wav
sample debris/metal3.wav
sample debris/metal4.wav
sample debris/metal5.wav
sample debris/metal6.wav
}
sfx_impact.grate
{
attenuation normal
sample debris/metal1.wav
sample debris/metal2.wav
sample debris/metal3.wav
sample debris/metal4.wav
sample debris/metal5.wav
sample debris/metal6.wav
}
sfx_impact.metal
{
attenuation normal
sample debris/metal1.wav
sample debris/metal2.wav
sample debris/metal3.wav
sample debris/metal4.wav
sample debris/metal5.wav
sample debris/metal6.wav
}
sfx_impact.glass
{
attenuation normal
sample debris/glass1.wav
sample debris/glass2.wav
sample debris/glass3.wav
sample debris/glass4.wav
}
sfx_impact.sand
{
attenuation normal
sample weapons/ric1.wav
sample weapons/ric2.wav
sample weapons/ric3.wav
sample weapons/ric4.wav
sample weapons/ric5.wav
}
sfx_impact.slosh
{
attenuation normal
sample weapons/ric1.wav
sample weapons/ric2.wav
sample weapons/ric3.wav
sample weapons/ric4.wav
sample weapons/ric5.wav
}
sfx_impact.snow
{
attenuation normal
sample weapons/ric1.wav
sample weapons/ric2.wav
sample weapons/ric3.wav
sample weapons/ric4.wav
sample weapons/ric5.wav
}
sfx_impact.tile
{
attenuation normal
sample weapons/ric1.wav
sample weapons/ric2.wav
sample weapons/ric3.wav
sample weapons/ric4.wav
sample weapons/ric5.wav
}
sfx_impact.wood
{
attenuation normal
sample debris/wood1.wav
sample debris/wood2.wav
sample debris/wood3.wav
sample debris/wood4.wav
}
sfx_impact.concrete
{
attenuation normal
sample debris/concrete1.wav
sample debris/concrete2.wav
sample debris/concrete3.wav
}

View file

@ -28,8 +28,6 @@ Footsteps_Init(void)
Sound_Precache("step_default.right");
Sound_Precache("step_alien.left");
Sound_Precache("step_alien.right");
Sound_Precache("step_bloodyflesh.left");
Sound_Precache("step_bloodyflesh.right");
Sound_Precache("step_computer.left");
Sound_Precache("step_computer.right");
Sound_Precache("step_concrete.left");
@ -83,7 +81,7 @@ Footsteps_HLBSP(base_player target)
mat_name = "step_alien";
break;
case MATID_BLOODYFLESH:
mat_name = "step_bloodyflesh";
mat_name = "step_flesh";
break;
case MATID_COMPUTER:
mat_name = "step_computer";
@ -162,7 +160,7 @@ Footsteps_VVBSP(base_player target)
case SURF_ALIEN:
mat_name = "step_alien";
break;
case SURF_FLESH:
case SURF_BLOODYFLESH:
mat_name = "step_flesh";
break;
case SURF_FOLIAGE:

View file

@ -65,33 +65,114 @@ TraceAttack_FireSingle(vector vecPos, vector vAngle, int iDamage, int iWeapon)
return;
}
surf = getsurfacenearpoint(trace_ent, trace_endpos);
tex = getsurfacetexture(trace_ent, surf);
switch (serverkeyfloat("*bspversion")) {
case BSPVER_HL:
surf = getsurfacenearpoint(trace_ent, trace_endpos);
tex = getsurfacetexture(trace_ent, surf);
/* our hashtable is the key to all this */
switch ((float)hash_get(hashMaterials, tex)) {
case 'G':
case 'V':
FX_Impact(IMPACT_METAL, trace_endpos, trace_plane_normal);
/* our hashtable is the key to all this */
switch ((float)hash_get(hashMaterials, tex)) {
case MATID_ALIEN:
FX_Impact(IMPACT_ALIEN, trace_endpos, trace_plane_normal);
break;
case MATID_COMPUTER:
FX_Impact(IMPACT_COMPUTER, trace_endpos, trace_plane_normal);
break;
case MATID_CONCRETE:
FX_Impact(IMPACT_CONCRETE, trace_endpos, trace_plane_normal);
break;
case MATID_DIRT:
FX_Impact(IMPACT_DIRT, trace_endpos, trace_plane_normal);
break;
case MATID_BLOODYFLESH:
case MATID_FLESH:
FX_Impact(IMPACT_FLESH, trace_endpos, trace_plane_normal);
break;
case MATID_FOLIAGE:
FX_Impact(IMPACT_FOLIAGE, trace_endpos, trace_plane_normal);
break;
case MATID_GLASS:
FX_Impact(IMPACT_GLASS, trace_endpos, trace_plane_normal);
break;
case MATID_GRATE:
FX_Impact(IMPACT_GRATE, trace_endpos, trace_plane_normal);
break;
case MATID_METAL:
FX_Impact(IMPACT_METAL, trace_endpos, trace_plane_normal);
break;
case MATID_SLOSH:
FX_Impact(IMPACT_SLOSH, trace_endpos, trace_plane_normal);
break;
case MATID_SNOW:
FX_Impact(IMPACT_SNOW, trace_endpos, trace_plane_normal);
break;
case MATID_TILE:
FX_Impact(IMPACT_TILE, trace_endpos, trace_plane_normal);
break;
case MATID_VENT:
FX_Impact(IMPACT_VENT, trace_endpos, trace_plane_normal);
break;
case MATID_WOOD:
FX_Impact(IMPACT_WOOD, trace_endpos, trace_plane_normal);
break;
default:
FX_Impact(IMPACT_DEFAULT, trace_endpos, trace_plane_normal);
break;
}
break;
case 'M':
case 'P':
FX_Impact(IMPACT_METAL, trace_endpos, trace_plane_normal);
case BSPVER_Q3: /* Q3 */
case BSPVER_RTCW: /* RtCW */
case BSPVER_RBSP: /* RFVBSP */
switch (trace_surfaceflagsi) {
case SURF_ALIEN:
FX_Impact(IMPACT_ALIEN, trace_endpos, trace_plane_normal);
break;
case SURF_COMPUTER:
FX_Impact(IMPACT_COMPUTER, trace_endpos, trace_plane_normal);
break;
case SURF_CONCRETE:
FX_Impact(IMPACT_CONCRETE, trace_endpos, trace_plane_normal);
break;
case SURF_DIRT:
FX_Impact(IMPACT_DIRT, trace_endpos, trace_plane_normal);
break;
case SURF_BLOODYFLESH:
FX_Impact(IMPACT_FLESH, trace_endpos, trace_plane_normal);
break;
case SURF_FOLIAGE:
FX_Impact(IMPACT_FOLIAGE, trace_endpos, trace_plane_normal);
break;
case SURF_GLASS:
FX_Impact(IMPACT_GLASS, trace_endpos, trace_plane_normal);
break;
case SURF_GRATE:
FX_Impact(IMPACT_GRATE, trace_endpos, trace_plane_normal);
break;
case SURF_METAL:
FX_Impact(IMPACT_METAL, trace_endpos, trace_plane_normal);
break;
case SURF_SLOSH:
FX_Impact(IMPACT_SLOSH, trace_endpos, trace_plane_normal);
break;
case SURF_SNOW:
FX_Impact(IMPACT_SNOW, trace_endpos, trace_plane_normal);
break;
case SURF_TILE:
FX_Impact(IMPACT_TILE, trace_endpos, trace_plane_normal);
break;
case SURF_VENT:
FX_Impact(IMPACT_VENT, trace_endpos, trace_plane_normal);
break;
case SURF_WOOD:
FX_Impact(IMPACT_WOOD, trace_endpos, trace_plane_normal);
break;
default:
FX_Impact(IMPACT_DEFAULT, trace_endpos, trace_plane_normal);
break;
}
break;
case 'D':
case 'W':
FX_Impact(IMPACT_WOOD, trace_endpos, trace_plane_normal);
break;
case 'Y':
FX_Impact(IMPACT_GLASS, trace_endpos, trace_plane_normal);
break;
case 'N':
FX_Impact(IMPACT_DEFAULT, trace_endpos, trace_plane_normal);
break;
case 'T':
default:
FX_Impact(IMPACT_DEFAULT, trace_endpos, trace_plane_normal);
break;
}
#ifdef BULLETPENETRATION

View file

@ -103,7 +103,7 @@ FX_Impact(int iType, vector vecPos, vector vNormal)
case IMPACT_METAL:
pointsound(vecPos, sprintf("weapons/ric_metal-%d.wav", floor((random() * 2) + 1)), 1, ATTN_STATIC);
break;
case IMPACT_ROCK:
case IMPACT_CONCRETE:
pointsound(vecPos, sprintf("weapons/ric_conc-%d.wav", floor((random() * 2) + 1)), 1, ATTN_STATIC);
break;
case IMPACT_FLESH:

View file

@ -20,11 +20,20 @@ enum
IMPACT_MELEE,
IMPACT_EXPLOSION,
IMPACT_DEFAULT,
IMPACT_GLASS,
IMPACT_WOOD,
IMPACT_METAL,
IMPACT_ALIEN,
IMPACT_COMPUTER,
IMPACT_CONCRETE,
IMPACT_DIRT,
IMPACT_FLESH,
IMPACT_ROCK
IMPACT_FOLIAGE,
IMPACT_GLASS,
IMPACT_GRATE,
IMPACT_METAL,
IMPACT_SLOSH,
IMPACT_SNOW,
IMPACT_TILE,
IMPACT_VENT,
IMPACT_WOOD
};
@ -65,7 +74,7 @@ enum
/* material surfaceflags (need to be masked) */
#define SURF_MASK 0x0FFFFFFFi
#define SURF_ALIEN 0x10000000i
#define SURF_FLESH 0x20000000i
#define SURF_BLOODYFLESH 0x20000000i
#define SURF_FOLIAGE 0x30000000i
#define SURF_COMPUTER 0x40000000i
#define SURF_DIRT 0x50000000i

View file

@ -40,11 +40,22 @@ var int DECAL_IMPACT_CONCRETE;
void
FX_Impact_Init(void)
{
precache_sound("weapons/ric1.wav");
precache_sound("weapons/ric2.wav");
precache_sound("weapons/ric3.wav");
precache_sound("weapons/ric4.wav");
precache_sound("weapons/ric5.wav");
Sound_Precache("sfx_impact.default");
Sound_Precache("sfx_impact.alien");
Sound_Precache("sfx_impact.flesh");
Sound_Precache("sfx_impact.foliage");
Sound_Precache("sfx_impact.computer");
Sound_Precache("sfx_impact.dirt");
Sound_Precache("sfx_impact.vent");
Sound_Precache("sfx_impact.grate");
Sound_Precache("sfx_impact.metal");
Sound_Precache("sfx_impact.glass");
Sound_Precache("sfx_impact.sand");
Sound_Precache("sfx_impact.slosh");
Sound_Precache("sfx_impact.snow");
Sound_Precache("sfx_impact.tile");
Sound_Precache("sfx_impact.wood");
Sound_Precache("sfx_impact.concrete");
FX_IMPACT_BLACKBITS = particleeffectnum("fx_impact.blackbits");
FX_IMPACT_SMOKE_GREY = particleeffectnum("fx_impact.smoke_grey");
@ -88,70 +99,110 @@ FX_Impact(int iType, vector vecPos, vector vNormal)
multicast(vecPos, MULTICAST_PVS);
#else
/* decals */
if (serverkeyfloat("*bspversion") == BSPVER_HL)
switch (iType) {
case IMPACT_GLASS:
Decals_Place(vecPos, sprintf("{break%d", floor(random(1,4))));
break;
case IMPACT_MELEE:
Decals_Place(vecPos, sprintf("{shot%d", floor(random(1,6))));
break;
default:
Decals_Place(vecPos, sprintf("{bigshot%d", floor(random(1,6))));
break;
}
else
switch (iType) {
case IMPACT_GLASS:
pointparticles(DECAL_IMPACT_GLASS, vecPos, vNormal, 1);
break;
case IMPACT_WOOD:
pointparticles(DECAL_IMPACT_WOOD, vecPos, vNormal, 1);
break;
case IMPACT_METAL:
pointparticles(DECAL_IMPACT_METAL, vecPos, vNormal, 1);
break;
case IMPACT_FLESH:
pointparticles(DECAL_IMPACT_FLESH, vecPos, vNormal, 1);
break;
default:
pointparticles(DECAL_IMPACT_DEFAULT, vecPos, vNormal, 1);
break;
}
switch (iType) {
case IMPACT_MELEE:
case IMPACT_EXPLOSION:
break;
if (serverkeyfloat("*bspversion") == BSPVER_HL) {
switch (iType) {
case IMPACT_GLASS:
pointparticles(FX_IMPACT_BLACKBITS, vecPos, vNormal, 1);
Decals_Place(vecPos, sprintf("{break%d", floor(random(1,4))));
break;
case IMPACT_MELEE:
Decals_Place(vecPos, sprintf("{shot%d", floor(random(1,6))));
break;
default:
Decals_Place(vecPos, sprintf("{bigshot%d", floor(random(1,6))));
break;
}
} else {
switch (iType) {
case IMPACT_GLASS:
pointparticles(DECAL_IMPACT_GLASS, vecPos, vNormal, 1);
break;
case IMPACT_WOOD:
pointparticles(FX_IMPACT_SPARK, vecPos, vNormal, 1);
pointparticles(FX_IMPACT_BLACKBITS, vecPos, vNormal, 1);
pointparticles(FX_IMPACT_SMOKE_BROWN, vecPos, vNormal, 1);
pointparticles(DECAL_IMPACT_WOOD, vecPos, vNormal, 1);
break;
case IMPACT_METAL:
pointparticles(FX_IMPACT_SPARK, vecPos, vNormal, 1);
pointparticles(FX_IMPACT_BLACKBITS, vecPos, vNormal, 1);
pointparticles(DECAL_IMPACT_METAL, vecPos, vNormal, 1);
break;
case IMPACT_FLESH:
FX_Blood(vecPos, vNormal);
pointparticles(DECAL_IMPACT_FLESH, vecPos, vNormal, 1);
break;
case IMPACT_DEFAULT:
default:
pointparticles(FX_IMPACT_SPARK, vecPos, vNormal, 1);
pointparticles(FX_IMPACT_BLACKBITS, vecPos, vNormal, 1);
pointparticles(FX_IMPACT_SMOKE_GREY, vecPos, vNormal, 1);
pointparticles(DECAL_IMPACT_DEFAULT, vecPos, vNormal, 1);
break;
}
}
switch (iType) {
case IMPACT_FLESH:
break;
default:
pointsound(vecPos, sprintf("weapons/ric%d.wav", floor((random() * 5) + 1)), 1, ATTN_STATIC);
break;
case IMPACT_MELEE:
case IMPACT_EXPLOSION:
break;
case IMPACT_GLASS:
pointparticles(FX_IMPACT_BLACKBITS, vecPos, vNormal, 1);
break;
case IMPACT_WOOD:
pointparticles(FX_IMPACT_SPARK, vecPos, vNormal, 1);
pointparticles(FX_IMPACT_BLACKBITS, vecPos, vNormal, 1);
pointparticles(FX_IMPACT_SMOKE_BROWN, vecPos, vNormal, 1);
break;
case IMPACT_METAL:
pointparticles(FX_IMPACT_SPARK, vecPos, vNormal, 1);
pointparticles(FX_IMPACT_BLACKBITS, vecPos, vNormal, 1);
break;
case IMPACT_FLESH:
FX_Blood(vecPos, vNormal);
break;
default:
pointparticles(FX_IMPACT_SPARK, vecPos, vNormal, 1);
pointparticles(FX_IMPACT_BLACKBITS, vecPos, vNormal, 1);
pointparticles(FX_IMPACT_SMOKE_GREY, vecPos, vNormal, 1);
break;
}
switch (iType) {
case IMPACT_ALIEN:
Sound_PlayAt(vecPos, "sfx_impact.alien");
break;
case IMPACT_COMPUTER:
Sound_PlayAt(vecPos, "sfx_impact.computer");
break;
case IMPACT_CONCRETE:
Sound_PlayAt(vecPos, "sfx_impact.concrete");
break;
case IMPACT_DIRT:
Sound_PlayAt(vecPos, "sfx_impact.dirt");
break;
case IMPACT_FLESH:
Sound_PlayAt(vecPos, "sfx_impact.flesh");
break;
case IMPACT_FOLIAGE:
Sound_PlayAt(vecPos, "sfx_impact.foliage");
break;
case IMPACT_GLASS:
Sound_PlayAt(vecPos, "sfx_impact.glass");
break;
case IMPACT_GRATE:
Sound_PlayAt(vecPos, "sfx_impact.grate");
break;
case IMPACT_METAL:
Sound_PlayAt(vecPos, "sfx_impact.metal");
break;
case IMPACT_SLOSH:
Sound_PlayAt(vecPos, "sfx_impact.slosh");
break;
case IMPACT_SNOW:
Sound_PlayAt(vecPos, "sfx_impact.snow");
break;
case IMPACT_TILE:
Sound_PlayAt(vecPos, "sfx_impact.tile");
break;
case IMPACT_VENT:
Sound_PlayAt(vecPos, "sfx_impact.vent");
break;
case IMPACT_WOOD:
Sound_PlayAt(vecPos, "sfx_impact.wood");
break;
default:
Sound_PlayAt(vecPos, "sfx_impact.default");
break;
}
#endif
}