detach sounds from disconnecting player

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@2092 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
driAn
2008-05-23 20:35:53 +00:00
parent e89d5f9600
commit c288c9829b
4 changed files with 23 additions and 1 deletions
-1
View File
@@ -203,7 +203,6 @@ void freebotent(botent *d)
void zapplayer(playerent *&d)
{
removebounceents(d);
DELETEP(d);
}
+12
View File
@@ -172,6 +172,7 @@ struct dynent : physent // animated ent
}
dynent() { reset(); resetanim(); }
virtual ~dynent() {}
};
#define MAXNAMELEN 15
@@ -368,6 +369,17 @@ struct playerent : dynent, playerstate
respawn();
}
virtual ~playerent()
{
extern void removebounceents(playerent *owner);
extern void detachsounds(playerent *owner);
extern physent *camera1;
extern void togglespect();
removebounceents(this);
detachsounds(this);
if(this==camera1) togglespect();
}
void damageroll(float damage)
{
float damroll = 2.0f*damage;
+1
View File
@@ -497,6 +497,7 @@ extern void checkplayerloopsounds();
extern void musicsuggest(int id, int millis = 0, bool rndofs = false);
extern void musicfadeout(int id);
extern void clearsounds();
extern void detachsounds(playerent *owner);
// rendermodel
extern void rendermodel(const char *mdl, int anim, int tex, float rad, const vec &o, float yaw, float pitch, float speed = 0, int basetime = 0, playerent *d = NULL, modelattach *a = NULL, float scale = 1.0f);
+10
View File
@@ -980,6 +980,16 @@ void playsoundname(char *s, const vec *loc, int vol)
void sound(int n) { playsound(n); }
COMMAND(sound, ARG_1INT);
void detachsounds(playerent *owner)
{
loopv(locations)
{
location &l = locations[i];
if(l.p != owner) continue;
l.attachtoworldobj(new vec(l.p->o));
}
}
void playsoundc(int n)
{
addmsg(SV_SOUND, "i", n);