From 78ad6b8420ea99cff7acfcdb914c8310b9c6609c Mon Sep 17 00:00:00 2001 From: Lee Salzman Date: Sat, 8 May 2010 22:44:47 +0000 Subject: [PATCH] give reload sound higher priority git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@4827 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/audiomanager.cpp | 6 +++--- source/src/protos.h | 2 +- source/src/sound.h | 2 +- source/src/soundlocation.cpp | 4 +--- source/src/soundscheduler.cpp | 2 +- source/src/weapon.cpp | 2 +- 6 files changed, 8 insertions(+), 10 deletions(-) diff --git a/source/src/audiomanager.cpp b/source/src/audiomanager.cpp index 28552d1d..17edad30 100644 --- a/source/src/audiomanager.cpp +++ b/source/src/audiomanager.cpp @@ -491,13 +491,13 @@ void audiomanager::playsoundname(char *s, const vec *loc, int vol) playsound(id, loc, SP_NORMAL); } -void audiomanager::playsoundc(int n, physent *p) +void audiomanager::playsoundc(int n, physent *p, int priority) { - if(p && p!=player1) playsound(n, p); + if(p && p!=player1) playsound(n, p, priority); else { addmsg(SV_SOUND, "i", n); - playsound(n); + playsound(n, priority); } } diff --git a/source/src/protos.h b/source/src/protos.h index 8adf53cd..938ba74e 100644 --- a/source/src/protos.h +++ b/source/src/protos.h @@ -588,7 +588,7 @@ extern void audiomgr.playsound(int n, int priority = SP_NORMAL); extern void audiomgr.playsound(int n, physent *p, int priority = SP_NORMAL); extern void audiomgr.playsound(int n, entity *e, int priority = SP_NORMAL); extern void audiomgr.playsound(int n, const vec *v, int priority = SP_NORMAL); -extern void audiomgr.playsoundc(int n, physent *p = NULL); +extern void audiomgr.playsoundc(int n, physent *p = NULL, int priority = SP_NORMAL); extern void initsound(); extern void soundcleanup(); extern void musicsuggest(int id, int millis = 0, bool rndofs = false); diff --git a/source/src/sound.h b/source/src/sound.h index c2f07117..1e7ed1a4 100644 --- a/source/src/sound.h +++ b/source/src/sound.h @@ -404,7 +404,7 @@ public: void playsound(int n, struct entity *e, int priority = SP_NORMAL); void playsound(int n, const vec *v, int priority = SP_NORMAL); void playsoundname(char *s, const vec *loc, int vol); - void playsoundc(int n, physent *p = NULL); + void playsoundc(int n, physent *p = NULL, int priority = SP_NORMAL); void sound(int n); int findsound(char *name, int vol, vector &sounds); void detachsounds(class playerent *owner); diff --git a/source/src/soundlocation.cpp b/source/src/soundlocation.cpp index 6d680231..0b92a581 100644 --- a/source/src/soundlocation.cpp +++ b/source/src/soundlocation.cpp @@ -233,9 +233,7 @@ location *locvector::find(int sound, worldobjreference *ref, const vectorpriority==SP_HIGHEST) continue; // highest priority sounds can't be replaced - vec otherpos = s->position(); + const vec & otherpos = s->position(); float otherdist = otherpos.iszero() ? 0.0f : camera1->o.dist(otherpos); float otherscore = (s->priority*soundschedpriorityscore) - (otherdist*soundscheddistancescore) + soundschedoldbonus; if(!worstsource || otherscore < worstscore) diff --git a/source/src/weapon.cpp b/source/src/weapon.cpp index 8f3888e9..6e1e67ee 100644 --- a/source/src/weapon.cpp +++ b/source/src/weapon.cpp @@ -596,7 +596,7 @@ bool weapon::reload() bool local = (player1 == owner); if(owner->type==ENT_BOT) audiomgr.playsound(info.reload, owner); - else audiomgr.playsoundc(info.reload); + else audiomgr.playsoundc(info.reload, NULL, local ? SP_HIGH : SP_NORMAL); if(local) addmsg(SV_RELOAD, "ri2", lastmillis, owner->weaponsel->type); return true; }