From bbd017766ee4163784e1c561469321805246abae Mon Sep 17 00:00:00 2001 From: Rafael Barreto Date: Fri, 21 May 2010 20:42:32 +0000 Subject: [PATCH] bug fix: head shot sound played in any sniper gibs git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@4991 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/clientgame.cpp | 6 +++--- source/src/clients2c.cpp | 4 ++-- source/src/protocol.cpp | 2 +- source/src/protos.h | 2 +- source/src/server.cpp | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index c3b4dcee..ec0b1eb7 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -639,12 +639,12 @@ void dodamage(int damage, playerent *pl, playerent *actor, bool gib, bool local) } damageeffect(damage, pl); - if(pl->health<=0) { if(local) dokill(pl, actor, gib); } + if(pl->health<=0) { if(local) dokill(pl, actor, gib, pl->weaponsel->type); } else if(pl==player1) audiomgr.playsound(S_PAIN6, SP_HIGH); else audiomgr.playsound(S_PAIN1+rnd(5), pl); } -void dokill(playerent *pl, playerent *act, bool gib) +void dokill(playerent *pl, playerent *act, bool gib, int gun) { if(pl->state!=CS_ALIVE || intermission) return; @@ -669,7 +669,7 @@ void dokill(playerent *pl, playerent *act, bool gib) if(gib) { - if(pl!=act && act->weaponsel->type == GUN_SNIPER) audiomgr.playsound(S_HEADSHOT, SP_LOW); + if(pl!=act && /*act->weaponsel->type*/ gun == GUN_SNIPER) audiomgr.playsound(S_HEADSHOT, SP_LOW); addgib(pl); } diff --git a/source/src/clients2c.cpp b/source/src/clients2c.cpp index dcdc8ee9..a82ab68d 100644 --- a/source/src/clients2c.cpp +++ b/source/src/clients2c.cpp @@ -578,13 +578,13 @@ void parsemessages(int cn, playerent *d, ucharbuf &p) case SV_GIBDIED: case SV_DIED: { - int vcn = getint(p), acn = getint(p), frags = getint(p); + int vcn = getint(p), acn = getint(p), frags = getint(p), gun = getint(p); playerent *victim = vcn==getclientnum() ? player1 : getclient(vcn), *actor = acn==getclientnum() ? player1 : getclient(acn); if(!actor) break; actor->frags = frags; if(!victim) break; - dokill(victim, actor, type==SV_GIBDIED); + dokill(victim, actor, type==SV_GIBDIED, gun); break; } diff --git a/source/src/protocol.cpp b/source/src/protocol.cpp index 04767794..eda30fc3 100644 --- a/source/src/protocol.cpp +++ b/source/src/protocol.cpp @@ -320,7 +320,7 @@ static const int msgsizes[] = // size inclusive message token, 0 f SV_SERVINFO, 5, SV_WELCOME, 2, SV_INITCLIENT, 0, SV_POS, 0, SV_POSC, 0, SV_POSN, 0, SV_TEXT, 0, SV_TEAMTEXT, 0, SV_TEXTME, 0, SV_TEAMTEXTME, 0, SV_SOUND, 2, SV_VOICECOM, 2, SV_VOICECOMTEAM, 2, SV_CDIS, 2, SV_SHOOT, 0, SV_EXPLODE, 0, SV_SUICIDE, 1, SV_AKIMBO, 2, SV_RELOAD, 3, SV_SCOPE, 3, - SV_GIBDIED, 4, SV_DIED, 4, SV_GIBDAMAGE, 6, SV_DAMAGE, 6, SV_HITPUSH, 6, SV_SHOTFX, 9, SV_THROWNADE, 8, + SV_GIBDIED, 5, SV_DIED, 5, SV_GIBDAMAGE, 6, SV_DAMAGE, 6, SV_HITPUSH, 6, SV_SHOTFX, 9, SV_THROWNADE, 8, SV_TRYSPAWN, 1, SV_SPAWNSTATE, 23, SV_SPAWN, 3, SV_SPAWNDENY, 2, SV_FORCEDEATH, 2, SV_RESUME, 0, SV_DISCSCORES, 0, SV_TIMEUP, 2, SV_EDITENT, 10, SV_ITEMACC, 2, SV_MAPCHANGE, 0, SV_ITEMSPAWN, 2, SV_ITEMPICKUP, 2, diff --git a/source/src/protos.h b/source/src/protos.h index 938ba74e..4b11316f 100644 --- a/source/src/protos.h +++ b/source/src/protos.h @@ -336,7 +336,7 @@ extern void initclient(); extern void deathstate(playerent *pl); extern void spawnplayer(playerent *d); extern void dodamage(int damage, playerent *pl, playerent *actor, bool gib = false, bool local = true); -extern void dokill(playerent *pl, playerent *act, bool gib = false); +extern void dokill(playerent *pl, playerent *act, bool gib = false, int gun = 0); extern playerent *newplayerent(); extern botent *newbotent(); extern void freebotent(botent *d); diff --git a/source/src/server.cpp b/source/src/server.cpp index 72b771d7..45f605cb 100644 --- a/source/src/server.cpp +++ b/source/src/server.cpp @@ -1318,7 +1318,7 @@ void serverdamage(client *target, client *actor, int damage, int gun, bool gib, suic = true; logline(ACLOG_INFO, "[%s] %s suicided", actor->hostname, actor->name); } - sendf(-1, 1, "ri4", gib ? SV_GIBDIED : SV_DIED, target->clientnum, actor->clientnum, actor->state.frags); + sendf(-1, 1, "ri5", gib ? SV_GIBDIED : SV_DIED, target->clientnum, actor->clientnum, actor->state.frags, gun); if((suic || tk) && (m_htf || m_ktf) && targethasflag >= 0) { actor->state.flagscore--;