diff options
Diffstat (limited to 'src/qcommon')
-rw-r--r-- | src/qcommon/msg.c | 65 | ||||
-rw-r--r-- | src/qcommon/q_shared.h | 9 |
2 files changed, 24 insertions, 50 deletions
diff --git a/src/qcommon/msg.c b/src/qcommon/msg.c index d46c2a3b..ac581b9e 100644 --- a/src/qcommon/msg.c +++ b/src/qcommon/msg.c @@ -823,7 +823,7 @@ netField_t entityStateFields[] = { NETF(origin[1]), 0 }, { NETF(origin[2]), 0 }, { NETF(solid), 24 }, -{ NETF(powerups), MAX_POWERUPS }, +{ NETF(misc), MAX_MISC }, { NETF(modelindex), 8 }, { NETF(otherEntityNum2), GENTITYNUM_BITS }, { NETF(loopSound), 8 }, @@ -1143,6 +1143,8 @@ netField_t playerStateFields[] = { PSF(damageYaw), 8 }, { PSF(damagePitch), 8 }, { PSF(damageCount), 8 }, +{ PSF(ammo), 12 }, +{ PSF(clips), 4 }, { PSF(generic1), 16 }, { PSF(pm_type), 8 }, { PSF(delta_angles[0]), 16 }, @@ -1171,8 +1173,7 @@ void MSG_WriteDeltaPlayerstate( msg_t *msg, struct playerState_s *from, struct p playerState_t dummy; int statsbits; int persistantbits; - int ammobits; - int powerupbits; + int miscbits; int numFields; int c; netField_t *field; @@ -1252,20 +1253,14 @@ void MSG_WriteDeltaPlayerstate( msg_t *msg, struct playerState_s *from, struct p persistantbits |= 1<<i; } } - ammobits = 0; - for (i=0 ; i<MAX_WEAPONS ; i++) { - if (to->ammo[i] != from->ammo[i]) { - ammobits |= 1<<i; - } - } - powerupbits = 0; - for (i=0 ; i<MAX_POWERUPS ; i++) { - if (to->powerups[i] != from->powerups[i]) { - powerupbits |= 1<<i; + miscbits = 0; + for (i=0 ; i<MAX_MISC ; i++) { + if (to->misc[i] != from->misc[i]) { + miscbits |= 1<<i; } } - if (!statsbits && !persistantbits && !ammobits && !powerupbits) { + if (!statsbits && !persistantbits && !miscbits) { MSG_WriteBits( msg, 0, 1 ); // no change oldsize += 4; return; @@ -1294,23 +1289,12 @@ void MSG_WriteDeltaPlayerstate( msg_t *msg, struct playerState_s *from, struct p } - if ( ammobits ) { - MSG_WriteBits( msg, 1, 1 ); // changed - MSG_WriteBits( msg, ammobits, MAX_WEAPONS ); - for (i=0 ; i<MAX_WEAPONS ; i++) - if (ammobits & (1<<i) ) - MSG_WriteShort (msg, to->ammo[i]); - } else { - MSG_WriteBits( msg, 0, 1 ); // no change - } - - - if ( powerupbits ) { + if ( miscbits ) { MSG_WriteBits( msg, 1, 1 ); // changed - MSG_WriteBits( msg, powerupbits, MAX_POWERUPS ); - for (i=0 ; i<MAX_POWERUPS ; i++) - if (powerupbits & (1<<i) ) - MSG_WriteLong( msg, to->powerups[i] ); + MSG_WriteBits( msg, miscbits, MAX_MISC ); + for (i=0 ; i<MAX_MISC ; i++) + if (miscbits & (1<<i) ) + MSG_WriteLong( msg, to->misc[i] ); } else { MSG_WriteBits( msg, 0, 1 ); // no change } @@ -1424,24 +1408,13 @@ void MSG_ReadDeltaPlayerstate (msg_t *msg, playerState_t *from, playerState_t *t } } - // parse ammo - if ( MSG_ReadBits( msg, 1 ) ) { - LOG("PS_AMMO"); - bits = MSG_ReadBits (msg, MAX_WEAPONS); - for (i=0 ; i<MAX_WEAPONS ; i++) { - if (bits & (1<<i) ) { - to->ammo[i] = MSG_ReadShort(msg); - } - } - } - - // parse powerups + // parse misc data if ( MSG_ReadBits( msg, 1 ) ) { - LOG("PS_POWERUPS"); - bits = MSG_ReadBits (msg, MAX_POWERUPS); - for (i=0 ; i<MAX_POWERUPS ; i++) { + LOG("PS_MISC"); + bits = MSG_ReadBits (msg, MAX_MISC); + for (i=0 ; i<MAX_MISC ; i++) { if (bits & (1<<i) ) { - to->powerups[i] = MSG_ReadLong(msg); + to->misc[i] = MSG_ReadLong(msg); } } } diff --git a/src/qcommon/q_shared.h b/src/qcommon/q_shared.h index 8c61aa7d..3622097b 100644 --- a/src/qcommon/q_shared.h +++ b/src/qcommon/q_shared.h @@ -1013,7 +1013,7 @@ typedef struct { // bit field limits #define MAX_STATS 16 #define MAX_PERSISTANT 16 -#define MAX_POWERUPS 16 +#define MAX_MISC 16 #define MAX_WEAPONS 16 #define MAX_PS_EVENTS 2 @@ -1085,8 +1085,9 @@ typedef struct playerState_s { int stats[MAX_STATS]; int persistant[MAX_PERSISTANT]; // stats that aren't cleared on death - int powerups[MAX_POWERUPS]; // level.time that the powerup runs out - int ammo[MAX_WEAPONS]; + int misc[MAX_MISC]; // misc data + int ammo; // ammo held + int clips; // clips held int generic1; int loopSound; @@ -1204,7 +1205,7 @@ typedef struct entityState_s { int eventParm; // for players - int powerups; // bit flags + int misc; // bit flags int weapon; // determines weapon and flash model, etc int legsAnim; // mask off ANIM_TOGGLEBIT int torsoAnim; // mask off ANIM_TOGGLEBIT |