cleaner primary weapon syncing fix
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@3869 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
@@ -334,7 +334,9 @@ void parsemessages(int cn, playerent *d, ucharbuf &p)
|
||||
s->lifesequence = getint(p);
|
||||
s->health = getint(p);
|
||||
s->armour = getint(p);
|
||||
s->selectweapon(getint(p));
|
||||
int gunselect = getint(p);
|
||||
s->setprimary(gunselect);
|
||||
s->selectweapon(gunselect);
|
||||
loopi(NUMGUNS) s->ammo[i] = getint(p);
|
||||
loopi(NUMGUNS) s->mag[i] = getint(p);
|
||||
s->state = CS_SPAWNING;
|
||||
@@ -460,7 +462,7 @@ void parsemessages(int cn, playerent *d, ucharbuf &p)
|
||||
{
|
||||
int cn = getint(p);
|
||||
if(p.overread() || cn<0) break;
|
||||
int state = getint(p), lifesequence = getint(p), gunselect = getint(p), flagscore = getint(p), frags = getint(p), deaths = getint(p), health = getint(p), armour = getint(p);
|
||||
int state = getint(p), lifesequence = getint(p), primary = getint(p), gunselect = getint(p), flagscore = getint(p), frags = getint(p), deaths = getint(p), health = getint(p), armour = getint(p);
|
||||
int ammo[NUMGUNS], mag[NUMGUNS];
|
||||
loopi(NUMGUNS) ammo[i] = getint(p);
|
||||
loopi(NUMGUNS) mag[i] = getint(p);
|
||||
@@ -473,6 +475,7 @@ void parsemessages(int cn, playerent *d, ucharbuf &p)
|
||||
d->deaths = deaths;
|
||||
if(d!=player1)
|
||||
{
|
||||
d->setprimary(primary);
|
||||
d->selectweapon(gunselect);
|
||||
d->health = health;
|
||||
d->armour = armour;
|
||||
|
||||
+1
-6
@@ -268,12 +268,7 @@ struct playerstate
|
||||
additem(ammostats[GUN_PISTOL], ammo[GUN_PISTOL]);
|
||||
additem(ammostats[GUN_AKIMBO], ammo[GUN_AKIMBO]);
|
||||
break;
|
||||
case I_AMMO: // ugly fix: we don't know the 'primary' of other players -> restock all ammo types
|
||||
additem(ammostats[GUN_SHOTGUN], ammo[GUN_SHOTGUN]);
|
||||
additem(ammostats[GUN_SUBGUN], ammo[GUN_SUBGUN]);
|
||||
additem(ammostats[GUN_SNIPER], ammo[GUN_SNIPER]);
|
||||
additem(ammostats[GUN_ASSAULT], ammo[GUN_ASSAULT]);
|
||||
break;
|
||||
case I_AMMO: additem(ammostats[primary], ammo[primary]); break;
|
||||
case I_GRENADE: additem(ammostats[GUN_GRENADE], mag[GUN_GRENADE]); break;
|
||||
case I_HEALTH: additem(powerupstats[type-I_HEALTH], health); break;
|
||||
case I_ARMOUR: additem(powerupstats[type-I_HEALTH], armour); break;
|
||||
|
||||
@@ -2318,10 +2318,11 @@ void getservermap(void)
|
||||
|
||||
void sendresume(client &c, bool broadcast)
|
||||
{
|
||||
sendf(broadcast ? -1 : c.clientnum, 1, "rxii9vvi", broadcast ? c.clientnum : -1, SV_RESUME,
|
||||
sendf(broadcast ? -1 : c.clientnum, 1, "rxi2i9vvi", broadcast ? c.clientnum : -1, SV_RESUME,
|
||||
c.clientnum,
|
||||
c.state.state,
|
||||
c.state.lifesequence,
|
||||
c.state.primary,
|
||||
c.state.gunselect,
|
||||
c.state.flagscore,
|
||||
c.state.frags,
|
||||
@@ -2441,6 +2442,7 @@ void welcomepacket(ucharbuf &p, int n, ENetPacket *packet, bool forcedeath)
|
||||
putint(p, c.clientnum);
|
||||
putint(p, c.state.state);
|
||||
putint(p, c.state.lifesequence);
|
||||
putint(p, c.state.primary);
|
||||
putint(p, c.state.gunselect);
|
||||
putint(p, c.state.flagscore);
|
||||
putint(p, c.state.frags);
|
||||
|
||||
Reference in New Issue
Block a user