From fb21aae502e4779d941ef73758293ebdf0e1dec1 Mon Sep 17 00:00:00 2001 From: flowtron Date: Sun, 4 May 2008 14:04:17 +0000 Subject: [PATCH] chasing/embodying the followed player (currently with translucent display of client during "embodiment") git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@1868 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/rendergl.cpp | 15 ++++++++++++--- source/src/rendermodel.cpp | 2 ++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/source/src/rendergl.cpp b/source/src/rendergl.cpp index 9e93aad8..4b5e19db 100644 --- a/source/src/rendergl.cpp +++ b/source/src/rendergl.cpp @@ -328,6 +328,7 @@ void recomputecamera() camera1 = player1; break; case SM_FOLLOWPLAYER: + case SM_EMBODYPLAYER: if(!players.inrange(player1->followplayercn) || !players[player1->followplayercn]) { toggledeathcam(); @@ -347,9 +348,16 @@ void recomputecamera() camera1 = &followcam; } followcam.o = p->o; - followcam.o.x -= (float)(cosf(RAD*(p->yaw-90)))*p->radius*1.5f; - followcam.o.y -= (float)(sinf(RAD*(p->yaw-90)))*p->radius*1.5f; - followcam.o.z += p->eyeheight/3.0f; + if(player1->spectating == SM_FOLLOWPLAYER) + { + followcam.o.x -= (float)(cosf(RAD*(p->yaw-90)))*p->radius*1.5f; + followcam.o.y -= (float)(sinf(RAD*(p->yaw-90)))*p->radius*1.5f; + followcam.o.z += p->eyeheight/3.0f; + } + else + { + followcam.o.z += p->eyeheight/6.0f; + } followcam.yaw = p->yaw; break; } @@ -655,6 +663,7 @@ void drawhudgun(int w, int h, float aspect, int farplane) sethudgunperspective(true); if(hudgun && player1->state==CS_ALIVE) player1->weaponsel->renderhudmodel(); + //if(hudgun && player1->state==CS_SPECTATE && players[player1->followplayercn]) players[player1->followplayercn]->weaponsel->renderhudmodel(); rendermenumdl(); sethudgunperspective(false); diff --git a/source/src/rendermodel.cpp b/source/src/rendermodel.cpp index 413223cd..1d222c60 100644 --- a/source/src/rendermodel.cpp +++ b/source/src/rendermodel.cpp @@ -439,6 +439,7 @@ void renderclient(playerent *d, const char *mdlname, const char *vwepname, int t vec o(d->o); o.z -= d->dyneyeheight(); int basetime = -((int)(size_t)d&0xFFF); + //if(player1->state == CS_SPECTATE && d->clientnum == player1->followplayercn) return; // don't draw followed player (or see below for "see through") if(d->state==CS_DEAD) { if(d==player1 && d->allowmove()) return; @@ -473,6 +474,7 @@ void renderclient(playerent *d, const char *mdlname, const char *vwepname, int t a[0].name = vwepname; a[0].tag = "tag_weapon"; } + if(player1->state == CS_SPECTATE && d->clientnum == player1->followplayercn && player1->spectating == SM_EMBODYPLAYER) anim |= ANIM_TRANSLUCENT; // see through followed player rendermodel(mdlname, anim, tex, 1.5f, o, d->yaw+90, d->pitch/4, speed, basetime, d, a); if(isteam(player1->team, d->team)) renderaboveheadicon(d); }