From 998f28dfb0477922616014f3953c18a97a6569e5 Mon Sep 17 00:00:00 2001 From: driAn Date: Tue, 25 Dec 2007 21:50:27 +0000 Subject: [PATCH] sound fx for bulletholes git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@1489 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- config/sounds.cfg | 5 ++--- source/src/entity.h | 1 + source/src/renderparticles.cpp | 14 ++++++++------ source/src/scoreboard.cpp | 2 +- source/src/sound.cpp | 1 - source/src/sound.h | 2 +- 6 files changed, 13 insertions(+), 12 deletions(-) diff --git a/config/sounds.cfg b/config/sounds.cfg index aa233056..b89ee61b 100755 --- a/config/sounds.cfg +++ b/config/sounds.cfg @@ -1,6 +1,8 @@ registersound "player/jump" //S_JUMP registersound "player/step" 60 // S_SOFTLAND registersound "player/land" 40 // S_HARDLAND +registersound "weapon/clip_empty" // S_BULLETBOUNCE TODO:NEW SOUND +registersound "weapon/clip_empty" // S_BULLETAIR TODO:NEW SOUND registersound "weapon/knife" //S_KNIFE registersound "weapon/usp" //S_PISTOL registersound "weapon/pistol_reload" //S_RPISTOL @@ -29,9 +31,6 @@ registersound "player/die2" //S_DIE2 registersound "weapon/grenade_exp" //S_FEXPLODE registersound "player/splash1" //S_SPLASH1 registersound "player/splash2" //S_SPLASH2 -registersound "ppm/deathr" //S_GRUNT1 16 -registersound "ppm/paine" //S_GRUNT2 -registersound "ppm/deathe" //S_RUMBLE registersound "ctf/flagdrop" //S_FLAGDROP registersound "ctf/flagpickup" //S_FLAGPICKUP registersound "ctf/flagreturn" //S_FLAGRETURN diff --git a/source/src/entity.h b/source/src/entity.h index cb30d15d..372e8bab 100644 --- a/source/src/entity.h +++ b/source/src/entity.h @@ -397,6 +397,7 @@ struct playerent : dynent, playerstate void selectweapon(int w) { weaponsel = weapons[(gunselect = w)]; } void setprimary(int w) { primweap = weapons[(primary = w)]; } void setnextprimary(int w) { nextprimweap = weapons[(nextprimary = w)]; } + bool isspectating() { return state==CS_SPECTATE || (state==CS_DEAD && spectating); } }; class CBot; diff --git a/source/src/renderparticles.cpp b/source/src/renderparticles.cpp index db32a5cb..cd07dd02 100644 --- a/source/src/renderparticles.cpp +++ b/source/src/renderparticles.cpp @@ -514,6 +514,7 @@ bool addbullethole(vec &from, vec &to, float radius) o.add(ray.mul(dist)); o.add(vec(surface).mul(0.005f)); newparticle(o, surface, holettl, 7); + playsound(S_BULLETBOUNCE, NULL, NULL, &o); return true; } @@ -528,15 +529,15 @@ bool addscorchmark(vec &o, float radius) return true; } +VARP(shotlinettl, 0, 0, 10000); + void addshotline(dynent *pl, vec &from, vec &to) { if(pl == player1) return; - if(rnd(3)) return; + bool fx = player1->isspectating() && shotlinettl > 0; // allow fx only in spect mode + if(rnd(3) && !fx) return; // show all shotlines when fx enabled - int start = 10; - if(camera1->o.dist(to) <= 10.0f) start = 8; - else start = 5; - + int start = (camera1->o.dist(to) <= 10.0f) ? 8 : 5; vec unitv; float dist = to.dist(from, unitv); unitv.div(dist); @@ -545,6 +546,7 @@ void addshotline(dynent *pl, vec &from, vec &to) o.mul(dist/10+start).add(from); vec d = unitv; d.mul(dist/10*-(10-start-2)).add(to); - newparticle(o, d, 75, 6); + newparticle(o, d, fx ? shotlinettl : 75, 6); + //playsound(S_BULLETAIR, NULL, NULL, NULL), } diff --git a/source/src/scoreboard.cpp b/source/src/scoreboard.cpp index 75d91e24..d79413d4 100644 --- a/source/src/scoreboard.cpp +++ b/source/src/scoreboard.cpp @@ -84,7 +84,7 @@ void renderteamscore(void *menu, teamscore *t) sline &line = scorelines.add(); s_sprintfd(plrs)("(%d %s)", t->teammembers.length(), t->teammembers.length() == 1 ? "player" : "players"); if(m_teammode) s_sprintf(line.s)("%d\t%d\t\t\t\t%s\t\t%s", t->frags, t->deaths, team_string(t->team), plrs); - static color teamcolors[2] = { color(1, 0, 0, 0.2f), color(0, 0, 1, 0.2f) }; + static color teamcolors[2] = { color(1.0f, 0, 0, 0.2f), color(0, 0, 1.0f, 0.2f) }; line.bgcolor = &teamcolors[t->team]; loopv(t->teammembers) renderscore(menu, t->teammembers[i]); } diff --git a/source/src/sound.cpp b/source/src/sound.cpp index 750b9c27..0756d02d 100644 --- a/source/src/sound.cpp +++ b/source/src/sound.cpp @@ -330,7 +330,6 @@ void updatechanvol(int chan, int svol, soundloc *sl) { vol -= (int)(dist*3*soundvol/255); // simple mono distance attenuation if(vol<0) vol = 0; - conoutf("vol %d", vol); } if(sl->pse) // control looping physent sound volume { diff --git a/source/src/sound.h b/source/src/sound.h index f353b4de..a75b5659 100644 --- a/source/src/sound.h +++ b/source/src/sound.h @@ -3,6 +3,7 @@ enum { S_JUMP = 0, S_SOFTLAND, S_HARDLAND, + S_BULLETBOUNCE, S_BULLETAIR, S_KNIFE, S_PISTOL, S_RPISTOL, S_SHOTGUN, S_RSHOTGUN, @@ -16,7 +17,6 @@ enum S_DIE1, S_DIE2, S_FEXPLODE, S_SPLASH1, S_SPLASH2, - S_GRUNT1, S_GRUNT2, S_RUMBLE, S_FLAGDROP, S_FLAGPICKUP, S_FLAGRETURN, S_FLAGSCORE, S_GRENADEPULL, S_GRENADETHROW, S_RAKIMBO, S_GUNCHANGE, S_GIB, S_HEADSHOT,