spectator fixes, recoil tuning
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@1450 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
@@ -811,3 +811,29 @@ void refreshsopmenu(void *menu, bool init)
|
||||
}
|
||||
}
|
||||
|
||||
void follownextplayer()
|
||||
{
|
||||
if(players.length())
|
||||
{
|
||||
loopv(players)
|
||||
{
|
||||
player1->followplayercn = (player1->followplayercn+1+i) % players.length();
|
||||
ASSERT(player1->followplayercn < players.length());
|
||||
if(players[player1->followplayercn] && players[player1->followplayercn]->state == CS_ALIVE) return;
|
||||
}
|
||||
}
|
||||
player1->spectating = SM_FLY;
|
||||
}
|
||||
|
||||
void toggledeathcam()
|
||||
{
|
||||
if(player1->spectating == SM_FOLLOWPLAYER) follownextplayer();
|
||||
else
|
||||
{
|
||||
player1->spectating = (player1->spectating+1) % SM_NUM;
|
||||
if(player1->spectating==SM_FOLLOWPLAYER)
|
||||
{
|
||||
follownextplayer();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -67,7 +67,7 @@ struct weaponmove
|
||||
if(progress > 100.0f || progress < 0) progress = 1.0f;
|
||||
// f(x) = -sin(x-1.5)^3
|
||||
kick = -sinf(pow((1.5f*progress)-1.5f,3));
|
||||
if(player1->crouching) kick *= 0.5f;
|
||||
if(player1->crouching) kick *= 0.75f;
|
||||
}
|
||||
|
||||
if(player1->lastaction && player1->lastattackgun==player1->gunselect)
|
||||
@@ -104,7 +104,7 @@ struct weaponmove
|
||||
sway.y *= swayspeed;
|
||||
sway.z *= swayupspeed;
|
||||
|
||||
if(player1->crouching) sway.mul(0.5f);
|
||||
if(player1->crouching) sway.mul(0.75f);
|
||||
}
|
||||
|
||||
pos.x -= base.x*k_back+sway.x;
|
||||
|
||||
+2
-18
@@ -427,7 +427,7 @@ void moveplayer(physent *pl, int moveres, bool local, int curtime)
|
||||
// smooth pitch
|
||||
if(pl == player1)
|
||||
{
|
||||
pl->pitch += pl->pitchvel*(curtime/1000.0f)*pl->maxspeed*(pl->crouching ? 0.5f : 1.0f);
|
||||
pl->pitch += pl->pitchvel*(curtime/1000.0f)*pl->maxspeed*(pl->crouching ? 0.75f : 1.0f);
|
||||
pl->pitchvel *= fpsfric-3;
|
||||
pl->pitchvel /= fpsfric;
|
||||
if(pl->pitchvel < 0.05f && pl->pitchvel > 0.001f) pl->pitchvel -= guns[((playerent *)pl)->gunselect].recoilbackfade/100.0f; // slide back
|
||||
@@ -489,23 +489,7 @@ void jumpn(bool on)
|
||||
if(intermission) return;
|
||||
if(player1->state==CS_DEAD)
|
||||
{
|
||||
if(on)
|
||||
{
|
||||
if(player1->spectating == SM_FOLLOWPLAYER)
|
||||
{
|
||||
if(players.inrange(player1->followplayercn+1) && players[player1->followplayercn+1])
|
||||
{
|
||||
player1->followplayercn++; // switch players
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
player1->spectating = (player1->spectating+1) % SM_NUM;
|
||||
switch(player1->spectating)
|
||||
{
|
||||
case SM_FOLLOWPLAYER: player1->followplayercn = 0;
|
||||
}
|
||||
}
|
||||
if(on) toggledeathcam();
|
||||
}
|
||||
else player1->jumpnext = on;
|
||||
}
|
||||
|
||||
@@ -205,6 +205,7 @@ extern void serveropcommand(int cmd, int arg1);
|
||||
extern void refreshsopmenu(void *menu, bool init);
|
||||
extern char *colorname(playerent *d, int num = 0, char *name = NULL, char *prefix = "");
|
||||
extern char *colorping(int ping);
|
||||
extern void toggledeathcam();
|
||||
|
||||
struct votedisplayinfo
|
||||
{
|
||||
|
||||
@@ -269,7 +269,7 @@ void recomputecamera()
|
||||
case SM_FOLLOWPLAYER:
|
||||
if(!players.inrange(player1->followplayercn) || !players[player1->followplayercn])
|
||||
{
|
||||
player1->spectating = SM_FLY;
|
||||
toggledeathcam();
|
||||
return;
|
||||
}
|
||||
playerent *p = players[player1->followplayercn];
|
||||
|
||||
@@ -705,7 +705,7 @@ void spreadandrecoil(vec &from, vec &to, playerent *d)
|
||||
}
|
||||
|
||||
// kickback
|
||||
d->vel.add(vec(unitv).mul(rcl/dist).mul(d->crouching ? 0.5 : 1.0f));
|
||||
d->vel.add(vec(unitv).mul(rcl/dist).mul(d->crouching ? 0.75 : 1.0f));
|
||||
// recoil
|
||||
d->pitchvel = min(pow(d->shots/(float)(g.recoilincrease), 2.0f)+(float)(g.recoilbase)/10.0f, (float)(g.maxrecoil)/10.0f);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user