switching between spect modes, demo recording fixes
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@1462 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
@@ -811,8 +811,9 @@ void refreshsopmenu(void *menu, bool init)
|
||||
}
|
||||
}
|
||||
|
||||
void follownextplayer()
|
||||
void followplayer(int i)
|
||||
{
|
||||
player1->spectating = SM_FOLLOWPLAYER;
|
||||
if(players.length())
|
||||
{
|
||||
loopv(players)
|
||||
@@ -827,15 +828,18 @@ void follownextplayer()
|
||||
|
||||
void toggledeathcam()
|
||||
{
|
||||
if(player1->spectating == SM_NONE) showscores(false);
|
||||
if(player1->spectating == SM_FOLLOWPLAYER) follownextplayer();
|
||||
if(player1->spectating == SM_NONE) showscores(false); // disable once
|
||||
|
||||
if(player1->spectating == SM_FOLLOWPLAYER) followplayer();
|
||||
else
|
||||
{
|
||||
player1->spectating = (player1->spectating+1) % SM_NUM;
|
||||
if(player1->spectating==SM_FOLLOWPLAYER)
|
||||
{
|
||||
follownextplayer();
|
||||
}
|
||||
if(player1->spectating==SM_FOLLOWPLAYER) followplayer();
|
||||
}
|
||||
}
|
||||
|
||||
COMMAND(followplayer, ARG_1INT);
|
||||
COMMAND(toggledeathcam, ARG_NONE);
|
||||
|
||||
int isalive() { return player1->state==CS_ALIVE ? 1 : 0; }
|
||||
COMMANDN(alive, isalive, ARG_1EXP);
|
||||
@@ -605,9 +605,13 @@ void parsemessages(int cn, playerent *d, ucharbuf &p)
|
||||
case SV_DEMOPLAYBACK:
|
||||
{
|
||||
int on = getint(p);
|
||||
if(on) { player1->state = CS_SPECTATE; } // player1->state = CS_SPECTATOR; // fixme,ah
|
||||
if(on)
|
||||
{
|
||||
player1->state = CS_SPECTATE;
|
||||
player1->spectating = SM_FLY;
|
||||
}
|
||||
//else stopdemo();
|
||||
else callvote(SA_STOPDEMO);
|
||||
else callvote(SA_STOPDEMO); // FIXME
|
||||
demoplayback = on!=0;
|
||||
break;
|
||||
}
|
||||
|
||||
+1
-1
@@ -321,7 +321,7 @@ struct playerent : dynent, playerstate
|
||||
int nextweapon; // weapon we switch to
|
||||
int skin, nextskin; // skin after respawning
|
||||
int spectating, followplayercn;
|
||||
virtual float dyneyeheight() { return state==CS_DEAD && spectating==SM_FLY ? 1.0f : physent::dyneyeheight(); }
|
||||
virtual float dyneyeheight() { return (state==CS_DEAD || state==CS_SPECTATE) && spectating==SM_FLY ? 1.0f : physent::dyneyeheight(); }
|
||||
bool allowmove() { return state!=CS_DEAD || spectating==SM_FLY; }
|
||||
|
||||
int thrownademillis;
|
||||
|
||||
@@ -232,7 +232,7 @@ void moveplayer(physent *pl, int moveres, bool local, int curtime)
|
||||
{
|
||||
const bool water = hdr.waterlevel>pl->o.z-0.5f;
|
||||
const bool editfly = (editmode && local) || pl->state==CS_EDITING;
|
||||
const bool specfly = local && pl->type==ENT_PLAYER && (pl->state==CS_SPECTATE || ((playerent *)pl)->spectating==SM_FLY);
|
||||
const bool specfly = local && pl->type==ENT_PLAYER && ((playerent *)pl)->spectating==SM_FLY;
|
||||
|
||||
const float speed = curtime/(water ? 2000.0f : 1000.0f)*pl->maxspeed*(pl->crouching ? 0.5f : 1.0f);
|
||||
const float friction = water ? 20.0f : (pl->onfloor || editfly || specfly ? 6.0f : (pl->onladder ? 1.5f : 30.0f));
|
||||
@@ -487,9 +487,9 @@ void attack(bool on)
|
||||
void jumpn(bool on)
|
||||
{
|
||||
if(intermission) return;
|
||||
if(player1->state==CS_DEAD)
|
||||
if(player1->state==CS_DEAD || player1->state==CS_SPECTATE)
|
||||
{
|
||||
if(on) toggledeathcam();
|
||||
if(on) player1->spectating = SM_FLY;
|
||||
}
|
||||
else if(player1->crouching) return;
|
||||
else player1->jumpnext = on;
|
||||
|
||||
@@ -206,6 +206,7 @@ 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();
|
||||
extern void followplayer(int i = 1);
|
||||
|
||||
struct votedisplayinfo
|
||||
{
|
||||
|
||||
@@ -246,7 +246,7 @@ physent *camera1 = NULL;
|
||||
|
||||
void recomputecamera()
|
||||
{
|
||||
if(player1->state==CS_DEAD && !editmode)
|
||||
if((player1->state==CS_SPECTATE || player1->state==CS_DEAD) && !editmode)
|
||||
{
|
||||
switch(player1->spectating)
|
||||
{
|
||||
|
||||
@@ -1477,13 +1477,6 @@ bool callvote(voteinfo *v) // true if a regular vote was called
|
||||
}
|
||||
else
|
||||
{
|
||||
/*if(clients[v->owner]->role >= v->action->role) // pass server op commands
|
||||
{
|
||||
v->action->perform();
|
||||
return true;
|
||||
}
|
||||
else*/
|
||||
|
||||
// regular vote
|
||||
{
|
||||
if(curvote)
|
||||
@@ -1496,7 +1489,7 @@ bool callvote(voteinfo *v) // true if a regular vote was called
|
||||
sendf(v->owner, 1, "ri2", SV_CALLVOTEERR, VOTEE_DISABLED);
|
||||
return false;
|
||||
}
|
||||
else if(clients[v->owner]->lastvotecall && servmillis - clients[v->owner]->lastvotecall < 60*1000 && clients[v->owner]->role < v->action->role)
|
||||
else if(clients[v->owner]->lastvotecall && servmillis - clients[v->owner]->lastvotecall < 60*1000 && clients[v->owner]->role < v->action->role && numclients()>1)
|
||||
{
|
||||
sendf(v->owner, 1, "ri2", SV_CALLVOTEERR, VOTEE_MAX);
|
||||
return false;
|
||||
|
||||
+11
-10
@@ -60,25 +60,29 @@ void weapon(int gun)
|
||||
|
||||
void shiftweapon(int s)
|
||||
{
|
||||
for(int i = 0; i < NUMGUNS && !player1->weaponchanging; i++)
|
||||
if(player1->state==CS_ALIVE)
|
||||
{
|
||||
int trygun = player1->gunselect + s + (s < 0 ? -i : i);
|
||||
if((trygun %= NUMGUNS) < 0) trygun += NUMGUNS;
|
||||
weapon(trygun);
|
||||
for(int i = 0; i < NUMGUNS && !player1->weaponchanging; i++)
|
||||
{
|
||||
int trygun = player1->gunselect + s + (s < 0 ? -i : i);
|
||||
if((trygun %= NUMGUNS) < 0) trygun += NUMGUNS;
|
||||
weapon(trygun);
|
||||
}
|
||||
}
|
||||
else toggledeathcam();
|
||||
}
|
||||
|
||||
int currentprimary() { return player1->primary; }
|
||||
int curweapon() { return player1->gunselect; }
|
||||
int magcontent(int gun) { if(gun > 0 && gun < NUMGUNS) return player1->mag[gun]; else return -1;}
|
||||
int magreserve(int gun) { if(gun > 0 && gun < NUMGUNS) return player1->ammo[gun]; else return -1;} // MeatROme
|
||||
int magreserve(int gun) { if(gun > 0 && gun < NUMGUNS) return player1->ammo[gun]; else return -1;}
|
||||
|
||||
COMMAND(weapon, ARG_1INT);
|
||||
COMMAND(shiftweapon, ARG_1INT);
|
||||
COMMAND(currentprimary, ARG_1EST);
|
||||
COMMAND(curweapon, ARG_1EXP);
|
||||
COMMAND(magcontent, ARG_1EXP);
|
||||
COMMAND(magreserve, ARG_1EXP); // MeatROme
|
||||
COMMAND(magreserve, ARG_1EXP);
|
||||
|
||||
VAR(scopefov, 5, 50, 50);
|
||||
bool scoped = false;
|
||||
@@ -86,7 +90,7 @@ int oldfov = 100;
|
||||
|
||||
void setscope(bool activate)
|
||||
{
|
||||
if(player1->gunselect != GUN_SNIPER || player1->state == CS_DEAD) return;
|
||||
if(player1->gunselect != GUN_SNIPER || player1->state == CS_DEAD || player1->reloading) return;
|
||||
if(activate == scoped) return;
|
||||
if(activate)
|
||||
{
|
||||
@@ -708,9 +712,6 @@ void spreadandrecoil(vec &from, vec &to, playerent *d)
|
||||
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);
|
||||
|
||||
//if(d->pitch < 80.0f) d->pitchvel += guns[d->gunselect].recoil*0.15f*(float)testrecoil/100.0f;
|
||||
//if(d->pitch<80.0f) d->pitch += guns[d->gunselect].recoil*0.05f;
|
||||
}
|
||||
|
||||
bool hasammo(playerent *d) // bot mod
|
||||
|
||||
Reference in New Issue
Block a user