From cd7ad94fa4ff74fee534be2b4145939f699d3b61 Mon Sep 17 00:00:00 2001 From: Lucas GAUTHERON Date: Sun, 22 May 2011 10:54:42 +0000 Subject: [PATCH] hitsound when following (spectating) a player git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6457 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/clientgame.cpp | 9 +++++++-- source/src/entity.h | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index 855b287c..679e77ee 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -815,8 +815,10 @@ void dodamage(int damage, playerent *pl, playerent *actor, int gun, bool gib, bo if(pl->state != CS_ALIVE || intermission) return; pl->respawnoffset = pl->lastpain = lastmillis; // could the author of the FIXME below please elaborate what's to fix?! (ft:2011mar28) -// playerent *h = local ? player1 : updatefollowplayer(0); - if(/*actor==h && pl!=actor*/ actor == player1 && pl!=actor ) // FIXME + // I suppose someone wanted to play the hitsound for player1 or spectated player (lucas:2011may22) + playerent *h = player1->isspectating() && player1->followplayercn > 0 ? getclient(player1->followplayercn) : NULL; + if(!h) h = player1; + if(actor==h && pl!=actor) { if(hitsound && lasthit != lastmillis) audiomgr.playsound(S_HITSOUND, SP_HIGH); lasthit = lastmillis; @@ -1655,6 +1657,9 @@ void spectate(int mode) } break; } + case SM_OVERVIEW: + player1->followplayercn = FPCN_OVERVIEW; + break; default: break; } player1->spectatemode = mode; diff --git a/source/src/entity.h b/source/src/entity.h index 5b800408..7bf09915 100644 --- a/source/src/entity.h +++ b/source/src/entity.h @@ -92,7 +92,7 @@ enum { ENT_PLAYER = 0, ENT_BOT, ENT_CAMERA, ENT_BOUNCE }; enum { CS_ALIVE = 0, CS_DEAD, CS_SPAWNING, CS_LAGGED, CS_EDITING, CS_SPECTATE }; enum { CR_DEFAULT = 0, CR_ADMIN }; enum { SM_NONE = 0, SM_DEATHCAM, SM_FOLLOW1ST, SM_FOLLOW3RD, SM_FOLLOW3RD_TRANSPARENT, SM_FLY, SM_OVERVIEW, SM_NUM }; -enum { FPCN_VOID = -3, FPCN_DEATHCAM = -2, FPCN_FLY = -1 }; +enum { FPCN_VOID = -4, FPCN_DEATHCAM = -2, FPCN_FLY = -2, FPCN_OVERVIEW = -1 }; class worldobject {