bool collidecamera() { switch(player1->state) { case CS_EDITING: return false; case CS_SPECTATOR: return followingplayer()!=NULL; } return true; }
void setupcamera() { fpsent *target = followingplayer(); if(target) { player1->yaw = target->yaw; // Kripken: needed? player1->pitch = target->state==CS_DEAD ? 0 : target->pitch; // Kripken: needed? player1->o = target->o; player1->resetinterp(); } }
int savedammo[NUMGUNS]; bool clientoption(const char *arg) { return false; } void taunt() { if(player1->state!=CS_ALIVE || player1->physstate<PHYS_SLOPE) return; if(lastmillis-player1->lasttaunt<1000) return; player1->lasttaunt = lastmillis; addmsg(N_TAUNT, "rc", player1); } COMMAND(taunt, ""); ICOMMAND(getfollow, "", (), { fpsent *f = followingplayer(); intret(f ? f->clientnum : -1); }); void follow(char *arg) { if(arg[0] ? player1->state==CS_SPECTATOR : following>=0) { following = arg[0] ? parseplayer(arg) : -1; if(following==player1->clientnum) following = -1; followdir = 0; conoutf("follow %s", following>=0 ? "on" : "off"); } } COMMAND(follow, "s");
fpsent *hudplayer() { if(thirdperson) return player1; fpsent *target = followingplayer(); return target ? target : player1; }
{ if(!specmode) stopfollowing(); else if(following < 0) nextfollow(); }); gameent *followingplayer() { if(player1->state!=CS_SPECTATOR || following<0) return NULL; gameent *target = getclient(following); if(target && target->state!=CS_SPECTATOR) return target; return NULL; } ICOMMAND(getfollow, "", (), { gameent *f = followingplayer(); intret(f ? f->clientnum : -1); }); void stopfollowing() { if(following<0) return; following = -1; } void follow(char *arg) { int cn = -1; if(arg[0]) { if(player1->state != CS_SPECTATOR) return;